gpt4 book ai didi

javascript - 戈朗 : html pages and GO communication

转载 作者:IT王子 更新时间:2023-10-29 01:59:36 26 4
gpt4 key购买 nike

除了模板之外,还有其他方法可以在 Go 和 html 页面之间进行通信吗?使用类似 postmessages 的东西?

场景::--> Streaming Twitter Api

流式 api 调用,在可用时更新新内容;

想要用最新的内容更新网页,保持原有内容不变。

想避免使用 NaCl... 因为它只适用于 Chrome

最佳答案

您可以使用网络套接字 ( WebSocket@Wikipedia )。

这里有两个实现:

golang.org/x/net/websocket

github.com/gorilla/websocket

这里是其他 websocket 包/实现的详尽列表:

godoc.org websocket search

关于javascript - 戈朗 : html pages and GO communication,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28196391/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com