MCPcopy Create free account
hub / github.com/axmolengine/axmol / dispatchEvents

Method dispatchEvents

core/network/WebSocket.cpp:270–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270void WebSocket::dispatchEvents()
271{
272 if (_eventQueue.unsafe_empty())
273 return;
274 if (_delegate)
275 {
276 auto lck = _eventQueue.get_lock();
277 while (!_eventQueue.empty())
278 {
279 auto event = _eventQueue.front();
280 _eventQueue.unsafe_pop_front();
281
282 switch (event->getType())
283 {
284 case Event::Type::ON_OPEN:
285 _delegate->onOpen(this);
286 break;
287 case Event::Type::ON_CLOSE:
288 _delegate->onClose(this, _closeCode, _closeReason);
289 break;
290 case Event::Type::ON_ERROR:
291 _delegate->onError(this, static_cast<ErrorEvent*>(event)->getErrorCode());
292 break;
293 case Event::Type::ON_MESSAGE:
294 _delegate->onMessage(this, WebSocket::Data{static_cast<MessageEvent*>(event)});
295 break;
296 }
297
298 event->release();
299 }
300 }
301}
302
303void WebSocket::setupParsers()
304{

Callers

nothing calls this directly

Calls 12

unsafe_emptyMethod · 0.80
get_lockMethod · 0.80
unsafe_pop_frontMethod · 0.80
emptyMethod · 0.45
frontMethod · 0.45
getTypeMethod · 0.45
onOpenMethod · 0.45
onCloseMethod · 0.45
onErrorMethod · 0.45
getErrorCodeMethod · 0.45
onMessageMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected