STREAM

INTRO

WebSocket n2o_stream is implemented cowboy_websocket_handler behaviour for WS protocol and cowboy_http_handler handler for XHR protocol. Both protocols are supported in single file. This module is only for using N2O with cowboy web server.

API

The n2o_proto protocol loop is compatible with cowboy and emqttd versions of N2O. The main purpose of this API is to embed N2O into your functional endpoint. In other cases it's called automatically by configuration.

The stream function is dedicated for cowboy version of n2o
websocket_info({ text | binary, binary() }, term(), term()) -> #reply{}.
This function is called on message arrival
websocket_handle({ text | binary, binary() }, term(), term()) -> #reply{}.
This function is called on init
websocket_init(term(), term(), term()) -> #reply{}.
This function is called on terminate
websocket_terminate(term(), term(), term()) -> #reply{}.
The info function is dedicated for HTTP XHR fallback
info(term(), term(), term()) -> #reply{}.

CONFIG

[{n2o,[{protocols,[n2o_nitro]}, {filter,{n2o_proto,push}}]}].

This module may refer to: n2o, n2o_pi.