javascript 如何使用 C++ 通过 websocket 发送数据?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4618606/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I use use C++ to send data through a websocket?
提问by Amir Rustamzadeh
I want to be able to send data over a websocket in my C++ code? Is there some library or standard way that this is done? Thanks for the help, I appreciate it, and please let me know if I should provide more information.
我希望能够在我的 C++ 代码中通过 websocket 发送数据?是否有一些图书馆或标准方法可以做到这一点?感谢您的帮助,我很感激,如果我应该提供更多信息,请告诉我。
采纳答案by Michael Hilbert
Please have a look at https://github.com/zaphoyd/websocketpp, which is based on Boost ASIO.
请查看基于 Boost ASIO 的https://github.com/zaphoyd/websocketpp。
You can find a comparison of websocket implementations at http://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations.
您可以在http://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations找到 websocket 实现的比较 。
回答by yasouser
Checkout Boost Asiolibrary.
结帐Boost Asio库。
回答by Nim
回答by MKroehnert
Check out the link to libwebsocket in the answer of warmcatto my question (Standalone C++ websocket server library)which was posted earlier.
查看之前发布的warmcat对我的问题(独立C++ websocket 服务器库)的回答中指向libwebsocket的链接。
Note that libwebsocket can be used for client and server side websockets.
请注意,libwebsocket 可用于客户端和服务器端 websocket。
回答by W1M0R
Beastis a C++ library using Boost Asio, demonstrated at CppCon 2016and used in rippled, an open source server application that implements a decentralized cryptocurrency system.
兽是使用升压短耳,在表现出C ++库CppCon 2016和在使用波纹,一个开源服务器应用程序,它实现一个分散cryptocurrency系统。
Also see this related questionand this one.
另请参阅this related question和this one。
回答by Ole
For a pure C++ approach to WebSockets using Boost.Asio check out: https://github.com/eidheim/Simple-WebSocket-Server
对于使用 Boost.Asio 的 WebSockets 的纯 C++ 方法,请查看:https: //github.com/eidheim/Simple-WebSocket-Server

