@@ -20,7 +20,6 @@ namespace ofxLibwebsockets {
2020 ofAddListener (oncloseEvent, this , &Protocol::_onclose);
2121 ofAddListener (onidleEvent, this , &Protocol::_onidle);
2222 ofAddListener (onmessageEvent, this , &Protocol::_onmessage);
23- ofAddListener (onbroadcastEvent, this , &Protocol::_onbroadcast);
2423 ofAddListener (onerrorEvent, this , &Protocol::_onerror);
2524 rx_buffer_size = OFX_LWS_MAX_BUFFER;
2625 idle = false ;
@@ -33,7 +32,6 @@ namespace ofxLibwebsockets {
3332 ofRemoveListener (oncloseEvent, this , &Protocol::_onclose);
3433 ofRemoveListener (onidleEvent, this , &Protocol::_onidle);
3534 ofRemoveListener (onmessageEvent, this , &Protocol::_onmessage);
36- ofRemoveListener (onbroadcastEvent, this , &Protocol::_onbroadcast);
3735 ofRemoveListener (onerrorEvent, this , &Protocol::_onerror);
3836 rx_buffer_size = OFX_LWS_MAX_BUFFER;
3937 idle = false ;
@@ -94,24 +92,4 @@ namespace ofxLibwebsockets {
9492 }
9593
9694 void Protocol::onmessage (Event&args){}
97-
98- // --------------------------------------------------------------
99- void Protocol::_onbroadcast (Event& args){ onbroadcast (args); }
100-
101- void Protocol::onbroadcast (Event&args){ args.conn .send (args.message ); }
102-
103- // --------------------------------------------------------------
104- void Protocol::broadcast (const std::string& message){
105- std::string buf (LWS_SEND_BUFFER_PRE_PADDING+message.size ()+LWS_SEND_BUFFER_POST_PADDING, 0 );
106- unsigned char *p = (unsigned char *)&buf[LWS_SEND_BUFFER_PRE_PADDING];
107-
108- if (reactor != NULL )
109- {
110- memcpy (p, message.c_str (), message.size ());
111- // int n = libwebsockets_broadcast(&reactor->lws_protocols[idx], p, message.size());
112- int n = libwebsocket_callback_on_writable_all_protocol (&reactor->lws_protocols [idx]);
113- if (n < 0 )
114- fprintf (stderr, " ERROR writing to socket" );
115- }
116- }
11795}
0 commit comments