ldak4747 commented on issue #825:
URL: https://github.com/apache/brpc/issues/825#issuecomment-1728692731

   > websocket要解决的问题一般可以通过[server 
push](https://github.com/apache/incubator-brpc/blob/master/docs/cn/server_push.md)、[持续下载](https://github.com/apache/incubator-brpc/blob/master/docs/cn/http_client.md#%E6%8C%81%E7%BB%AD%E4%B8%8B%E8%BD%BD)、[持续发送](https://github.com/apache/incubator-brpc/blob/master/docs/cn/http_service.md#%E6%8C%81%E7%BB%AD%E5%8F%91%E9%80%81)等实现
   
   
   
   我写了一个相对简单的,大概是这样,麻烦您帮看看思路是否对:
   
根据websocket的特点,服务端可以随时根据业务需求主动发送信息到客户端,可见潜台词这是长连接,故我在自己写的brpc/policy/ws_protocol.cpp中,封装了sender结构体,里包含socket和一个iobuf,服务端业务代码自己维护这个结构体,需要发送时,自行填充好iobuf,检查socket是否Failed(),如没有Failed(),则socket->Write(iobuf)。发送后清空iobuf。
   
   这个方式跳过了Controller。
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to