ext/iodine/websockets.c
/*******************************************************************************
Create/Destroy the websocket object
*/
Create/Destroy the websocket object
Create / Destroy the websocket object
static ws_s *new_websocket(intptr_t uuid) {
  ws_s *ws = malloc(sizeof(*ws));
  *ws = (ws_s){
      .protocol.ping = ws_ping,
      .protocol.on_data = on_data_first,
      .protocol.on_close = on_close,
      .protocol.on_ready = NULL ,
      .protocol.on_shutdown = on_shutdown,
      .subscriptions = FIO_LS_INIT(ws->subscriptions),
      .is_client = 0,
      .fd = uuid,
  };
  return ws;
}
static ws_s * new_websocket ( intptr_t uuid ) { ws_s * ws = malloc ( sizeof ( * ws ) ) ; * ws = ( ws_s ) { . protocol . ping = ws_ping , . protocol . on_data = on_data_first , . protocol . on_close = on_close , . protocol . on_ready = NULL , . protocol . on_shutdown = on_shutdown , . subscriptions = FIO_LS_INIT ( ws -> subscriptions ) , . is_client = 0 , . fd = uuid , } ; return ws ; }
Create/Destroy the websocket object
Create / Destroy the websocket object
// allocate the protocol object /* filled in after `on_open` */