5

请问 服务端渲染的站点如何使用 websocket?

 3 years ago
source link: https://www.v2ex.com/t/797249
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

请问 服务端渲染的站点如何使用 websocket?

  rita413413 · 12 小时 52 分钟前 via iPhone · 1106 次点击
最近自己在用 goframe +adminLTE 写一个后台管理站点,所有页面都是服务端渲染。我要做一些通知要用到 websicket 。这个前端的 websocket,要怎样创建才能只需要创建一次就好了?

现在的情况是,前端每点击一个菜单或者页面,都会全部重新渲染。(当然页面的部分数据请求使用的是 Ajax)

如果直接每点击一个页面就建立一次,断开一次,这样肯定不合理…… 请问有什么好的方法吗?

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK