mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-31 01:46:16 +02:00
Streaming clients can connect via Websockets
This commit is contained in:
parent
5723791f8a
commit
01ce9a60c0
19 changed files with 789 additions and 356 deletions
|
@ -33,14 +33,16 @@ using boost::asio::ip::tcp;
|
|||
|
||||
|
||||
class ControlSession;
|
||||
|
||||
class StreamSession;
|
||||
|
||||
/// Interface: callback for a received message.
|
||||
class ControlMessageReceiver
|
||||
{
|
||||
public:
|
||||
// TODO: rename, error handling
|
||||
virtual std::string onMessageReceived(ControlSession* connection, const std::string& message) = 0;
|
||||
virtual std::string onMessageReceived(ControlSession* session, const std::string& message) = 0;
|
||||
virtual void onNewSession(const std::shared_ptr<ControlSession>& session) = 0;
|
||||
virtual void onNewSession(const std::shared_ptr<StreamSession>& session) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -50,7 +52,7 @@ public:
|
|||
* Messages are sent to the client with the "send" method.
|
||||
* Received messages from the client are passed to the ControlMessageReceiver callback
|
||||
*/
|
||||
class ControlSession
|
||||
class ControlSession : public std::enable_shared_from_this<ControlSession>
|
||||
{
|
||||
public:
|
||||
/// ctor. Received message from the client are passed to MessageReceiver
|
||||
|
@ -61,9 +63,6 @@ public:
|
|||
virtual void start() = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
/// Sends a message to the client (synchronous)
|
||||
virtual bool send(const std::string& message) = 0;
|
||||
|
||||
/// Sends a message to the client (asynchronous)
|
||||
virtual void sendAsync(const std::string& message) = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue