{"action":"created","issue":{"url":"https://api.github.com/repos/esl/MongooseIM/issues/308","labels_url":"https://api.github.com/repos/esl/MongooseIM/issues/308/labels{/name}","comments_url":"https://api.github.com/repos/esl/MongooseIM/issues/308/comments","events_url":"https://api.github.com/repos/esl/MongooseIM/issues/308/events","html_url":"https://github.com/esl/MongooseIM/issues/308","id":48138816,"number":308,"title":"Secure Websockets Not Working","user":{"login":"efranford","id":1440363,"avatar_url":"https://avatars.githubusercontent.com/u/1440363?v=3","gravatar_id":"","url":"https://api.github.com/users/efranford","html_url":"https://github.com/efranford","followers_url":"https://api.github.com/users/efranford/followers","following_url":"https://api.github.com/users/efranford/following{/other_user}","gists_url":"https://api.github.com/users/efranford/gists{/gist_id}","starred_url":"https://api.github.com/users/efranford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/efranford/subscriptions","organizations_url":"https://api.github.com/users/efranford/orgs","repos_url":"https://api.github.com/users/efranford/repos","events_url":"https://api.github.com/users/efranford/events{/privacy}","received_events_url":"https://api.github.com/users/efranford/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-11-07T22:31:24Z","updated_at":"2015-07-21T16:32:25Z","closed_at":"2014-11-11T21:27:28Z","body":"Hi everyone,\r\n\r\nI am having issues connecting using wss.  I am able to connect with ws:// and my certificates for the other securities seem to be working.  I get the following error when I connect with wss.\r\n\r\n  ```\r\n2014-11-07 19:33:08.510 [error] emulator Error in process <0.528.0> on node 'mongooseim@localhost' with exit value: {function_clause,[{cowboy_protocol,parse_method,[<<0 bytes>>,{state,#Port<0.4389>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<9 bytes>>],[],[{[<<7 bytes>>],[],ejabberd_metrics_rest,[available_metrics...\r\n\r\n\r\n2014-11-07 19:33:08.510 [error] <0.493.0> Ranch listener 'ejabberd_cowboy_0.0.0.0_5280' had connection process started with cowboy_protocol:start_link/4 at <0.528.0> exit with reason: {function_clause,[{cowboy_protocol,parse_method,[<<>>,{state,#Port<0.4389>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<\"localhost\">>],[],[{[<<\"metrics\">>],[],ejabberd_metrics_rest,[available_metrics]},{[<<\"metrics\">>,<<\"m\">>],[],ejabberd_metrics_rest,[sum_metrics]},{[<<\"metrics\">>,<<\"m\">>,metric],[],ejabberd_metrics_rest,[sum_metric]},{[<<\"metrics\">>,<<\"host\">>,host,metric],[],ejabberd_metrics_rest,[host_metric]},{[<<\"metrics\">>,<<\"host\">>,host],[],ejabberd_metrics_rest,[host_metrics]},{[<<\"ws-xmpp\">>],[],mod_websockets,[]}]},{'_',[],[{[<<\"ws-xmpp\">>],[],mod_websockets,[]}]}]}],undefined,undefined,5,1,100,4096,64,4096,100,5000,1415388793509},<<22,3,1,0,137,1,0,0,133,3,2,192,152,23,167,137,52,42,65,108,178,100,202,128,250,159,99,17,111,31,109,67,46,84,67,254,110,172,255,63,204,115,221,0,0,30,86,0,192,10,192,9,192,19,192,20,192,7,192,17,0,51,0,50,0,57,0,47,0,53,0,10,0,5,0,4,1,0,0,62,0,0,0,14,0,12,0,0,9,108,111,99,97,108,104,111,115,116,255,1,0,1,0,0,10,0,8,0,6,0,23,0,24,0,25,0,11,0,2,1,0,0,35,0,0,117,80,0,0,0,5,0,5,1,0,0,0,0,0,18,0,0>>],[{file,\"src/cowboy_protocol.erl\"},{line,203}]}]}\r\n\r\n2014-11-07 19:33:08.813 [error] emulator Error in process <0.529.0> on node 'mongooseim@localhost' with exit value: {function_clause,[{cowboy_protocol,skip_uri_fragment,[<<0 bytes>>,{state,#Port<0.4390>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<9 bytes>>],[],[{[<<7 bytes>>],[],ejabberd_metrics_rest,[available_metrics...\r\n\r\n\r\n2014-11-07 19:33:08.813 [error] <0.493.0> Ranch listener 'ejabberd_cowboy_0.0.0.0_5280' had connection process started with cowboy_protocol:start_link/4 at <0.529.0> exit with reason: {function_clause,[{cowboy_protocol,skip_uri_fragment,[<<>>,{state,#Port<0.4390>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<\"localhost\">>],[],[{[<<\"metrics\">>],[],ejabberd_metrics_rest,[available_metrics]},{[<<\"metrics\">>,<<\"m\">>],[],ejabberd_metrics_rest,[sum_metrics]},{[<<\"metrics\">>,<<\"m\">>,metric],[],ejabberd_metrics_rest,[sum_metric]},{[<<\"metrics\">>,<<\"host\">>,host,metric],[],ejabberd_metrics_rest,[host_metric]},{[<<\"metrics\">>,<<\"host\">>,host],[],ejabberd_metrics_rest,[host_metrics]},{[<<\"ws-xmpp\">>],[],mod_websockets,[]}]},{'_',[],[{[<<\"ws-xmpp\">>],[],mod_websockets,[]}]}]}],undefined,undefined,5,1,100,4096,64,4096,100,5000,1415388793812},<<22,3,1,0,137,1,0,0,133,3,1,155,133,148,111,243,126>>,<<126,66,126,140,129,113,20,119,243,2,110,101,142,42,233,61,248,228,70,68,74,218,247,234,248,0,0,30,86,0,192,10,192,9,192,19,192,20,192,7,192,17,0,51,0,50,0,57,0,47,0,53,0,10,0,5,0,4,1,0,0,62,0,0,0,14,0,12,0,0,9,108,111,99,97,108,104,111,115,116,255,1,0,1,0,0,10,0,8,0,6,0,23,0,24,0,25,0,11,0,2,1,0,0>>,<<>>],[{file,\"src/cowboy_protocol.erl\"},{line,245}]}]}\r\n\r\n2014-11-07 19:33:09.208 [error] emulator Error in process <0.530.0> on node 'mongooseim@localhost' with exit value: {function_clause,[{cowboy_protocol,parse_method,[<<0 bytes>>,{state,#Port<0.4391>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<9 bytes>>],[],[{[<<7 bytes>>],[],ejabberd_metrics_rest,[available_metrics...\r\n\r\n\r\n2014-11-07 19:33:09.208 [error] <0.493.0> Ranch listener 'ejabberd_cowboy_0.0.0.0_5280' had connection process started with cowboy_protocol:start_link/4 at <0.530.0> exit with reason: {function_clause,[{cowboy_protocol,parse_method,[<<>>,{state,#Port<0.4391>,ranch_tcp,[cowboy_router,cowboy_handler],false,[{listener,'ejabberd_cowboy_0.0.0.0_5280'},{dispatch,[{[<<\"localhost\">>],[],[{[<<\"metrics\">>],[],ejabberd_metrics_rest,[available_metrics]},{[<<\"metrics\">>,<<\"m\">>],[],ejabberd_metrics_rest,[sum_metrics]},{[<<\"metrics\">>,<<\"m\">>,metric],[],ejabberd_metrics_rest,[sum_metric]},{[<<\"metrics\">>,<<\"host\">>,host,metric],[],ejabberd_metrics_rest,[host_metric]},{[<<\"metrics\">>,<<\"host\">>,host],[],ejabberd_metrics_rest,[host_metrics]},{[<<\"ws-xmpp\">>],[],mod_websockets,[]}]},{'_',[],[{[<<\"ws-xmpp\">>],[],mod_websockets,[]}]}]}],undefined,undefined,5,1,100,4096,64,4096,100,5000,1415388794115},<<22,3,0,0,63,1,0,0,59,3,0,213,247,216,123,139,209,40,140,122,163,59,119,193,241,187,220,75,159,78,247,241,182,239,17,67,209,56,122,117,185,171,54,0,0,20,0,255,86,0,0,51,0,50,0,57,0,47,0,53,0,10,0,5,0,4,1,0>>],[{file,\"src/cowboy_protocol.erl\"},{line,203}]}]}\r\n\r\n```\r\n\r\nI have created a [branch](https://github.com/efranford/MongooseIM/tree/help-with-secure-websockets) in my fork with my changes.  All you have to do is [install vagrant](https://docs.vagrantup.com/v2/installation/), clone off my branch, and run \"vagrant up\" from the projects directory. \r\n\r\nIt's worth noting that the server is at 192.168.33.77 on your local machine.  The connections I am trying with websocket are:\r\nws://192.168.33.77:5280/ws-xmpp\r\nwss://192.168.33.77:5280/ws-xmpp\r\n\r\nOnce it's running do the following in your console:\r\n\r\nvagrant ssh\r\ncd ../../mongooseim/rel/mongooseim\r\nbin/mongooseim live\r\n\r\nI have 5 test users:\r\nelliot1 | password\r\nelliot2 | password\r\nelliot3 | password\r\nelliot4 | password\r\nelliot5 | password\r\n\r\nI added the users to [Pidgin](https://www.pidgin.im/) and am using the MongooseIM/examples/websockets/jsjac/simpleclient.html to try to connect.  As you can see ws and the secure xmpp works, but when you try wss you will get an error similar to that above.\r\n\r\nI made some changes to my .gitignore so you shouldn't have to do any fiddling with my code and only a few steps during deployment. I really hope someone can help tell me where I went wrong!\r\n\r\nThanks in advance,\r\nElliot\r\n\r\nPS: Don't worry about the certificates, keys, and whatnot as they are for development only. "},"comment":{"url":"https://api.github.com/repos/esl/MongooseIM/issues/comments/123394184","html_url":"https://github.com/esl/MongooseIM/issues/308#issuecomment-123394184","issue_url":"https://api.github.com/repos/esl/MongooseIM/issues/308","id":123394184,"user":{"login":"preppypiet","id":1401077,"avatar_url":"https://avatars.githubusercontent.com/u/1401077?v=3","gravatar_id":"","url":"https://api.github.com/users/preppypiet","html_url":"https://github.com/preppypiet","followers_url":"https://api.github.com/users/preppypiet/followers","following_url":"https://api.github.com/users/preppypiet/following{/other_user}","gists_url":"https://api.github.com/users/preppypiet/gists{/gist_id}","starred_url":"https://api.github.com/users/preppypiet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/preppypiet/subscriptions","organizations_url":"https://api.github.com/users/preppypiet/orgs","repos_url":"https://api.github.com/users/preppypiet/repos","events_url":"https://api.github.com/users/preppypiet/events{/privacy}","received_events_url":"https://api.github.com/users/preppypiet/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T16:32:25Z","updated_at":"2015-07-21T16:32:25Z","body":"Heya, what was the issue? I'm having the exact same problem."}}