seasocks | Simple , small , C++ embeddable webserver with WebSockets | Websocket library
kandi X-RAY | seasocks Summary
kandi X-RAY | seasocks Summary
Simple, small, C++ embeddable webserver with WebSockets support
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of seasocks
seasocks Key Features
seasocks Examples and Code Snippets
Community Discussions
Trending Discussions on seasocks
QUESTION
I am using the Seasocks C++ library in order to add websocket functionality to an existing project. How do I initiate the sending of data to connected clients from the C++ code?
My code so far is as follows:
...ANSWER
Answered 2020-Apr-28 at 04:37Most of this is me restating the quick tutorial, but hopefully in a clearer way.
The function execute()
is a method on the server
object, and it accepts a "function to call" on the correct thread. Your example is trying to construct a new Server
, then call its execute
method with an initializer list (I think!).
To do useful work, though, you need to know which clients to send messages to. The server doesn't keep track of that: it delegates that responsibility to the individual Handler
s. Think of the Handler
as like a single web page handler: a website doesn't have "clients" but each page does (the clients that are viewing it)
You'll need to make a Handler for the page you want (e.g. the ChatHandler
in the tutorial). That handler will remember the list of clients attached to it:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install seasocks
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page