I use sockjs with cowboy
Cowboy
SockjsState = sockjs_handler:init_state(<<"/ws">>, fun my_sockjs_handler:hook/3, state, []),
Dispatch = cowboy_router:compile([
{'_', [
{<<"/ws/[...]">>,sockjs_cowboy_handler, SockjsState}
,{'_', my_handler, []}
]}
]),
{ok, _} = cowboy:start_https(https, 100, [
{port, 443},
{cacertfile, "priv/ssl/my_cacertfile.crt"},
{certfile, "priv/ssl/my_certfile.crt"},
{keyfile, "priv/ssl/my_key_file.key"}
], [{env, [{dispatch, Dispath}]}]),
Sockjs
var socket = new SockJS('/ws')
And it works pretty fine on https