nitrogen / simple_bridge

A simple, standardized interface library to Erlang HTTP Servers.
MIT License
112 stars 76 forks source link

Fixes to websockets: #50

Closed danikp closed 9 years ago

danikp commented 9 years ago
danikp commented 9 years ago

cowboy websockets manual for reference http://ninenines.eu/docs/en/cowboy/HEAD/manual/cowboy_websocket/

choptastic commented 9 years ago

Hi Dmitry,

I appreciate what you're doing here, and mostly understand what you're going for.

But I'm not a fan of supporting two synonyms to the same thing (noreply being synonymous with ok). Frankly, I'm not a fan at all of Cowboy's method of using 'ok' despite its attractive brevity. 'ok' has no meaning, whereas 'reply' and 'noreply' are very specific in their meaning.

Instead, to ensure support through CB, I'd recommend introducing a translation layer in CB itself, which, I suspect should be possible. Is there an example of a CB websocket handler which I can view? I've never played with CB's websocket features so I don't know all the ramifications.

For example, in https://github.com/danikp/ChicagoBoss/blob/simple_bridge/src/boss/boss_simple_bridge_handler.erl#L37-L38, the Response of ok should just be translated to noreply.

danikp commented 9 years ago

@choptastic , you are totally right. I reverted part of PR related to 'ok' and now it fix only typo and missing functions in handlers.