{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/560","repository_url":"https://api.github.com/repos/ReactiveX/RxNetty","labels_url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/560/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/560/comments","events_url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/560/events","html_url":"https://github.com/ReactiveX/RxNetty/issues/560","id":184470015,"number":560,"title":"(0.5.x) First message received right after connecting to WebSocket seems to be missing","user":{"login":"sokolas","id":786892,"avatar_url":"https://avatars.githubusercontent.com/u/786892?v=3","gravatar_id":"","url":"https://api.github.com/users/sokolas","html_url":"https://github.com/sokolas","followers_url":"https://api.github.com/users/sokolas/followers","following_url":"https://api.github.com/users/sokolas/following{/other_user}","gists_url":"https://api.github.com/users/sokolas/gists{/gist_id}","starred_url":"https://api.github.com/users/sokolas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sokolas/subscriptions","organizations_url":"https://api.github.com/users/sokolas/orgs","repos_url":"https://api.github.com/users/sokolas/repos","events_url":"https://api.github.com/users/sokolas/events{/privacy}","received_events_url":"https://api.github.com/users/sokolas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-21T12:07:34Z","updated_at":"2016-11-04T05:16:19Z","closed_at":null,"body":"I have a piece of code very similar to the example [EchoClient example](https://github.com/ReactiveX/RxNetty/blob/0.5.x/rxnetty-examples/src/main/java/io/reactivex/netty/examples/http/ws/echo/WebSocketEchoClient.java)\n\nHere it is:\n\n```\n        HttpClient.newClient(\"gateway.discord.gg\", 443)\n            .unsafeSecure().createGet(\"/?encoding=json&v=5\")\n            .requestWebSocketUpgrade()\n            .doOnNext(resp -> logger.info(resp.toString()))\n            .flatMap(resp -> resp.getWebSocketConnection())\n            .flatMap(conn -> conn.getInput())\n    .toBlocking().forEach(f -> logger.info(f.content().toString(Charset.defaultCharset())));\n```\n\nWhen connected, the client should receive a message from the server, like this: `{\"t\":null,\"s\":null,\"op\":10,\"d\":{\"heartbeat_interval\":41250,\"_trace\":[\"discord-gateway-prd-1-12\"]}}`\n\nA working example can be found here: [WebSocket example (jsfiddle)](https://jsfiddle.net/k6j02Lb0/) - run it and look in the browser console for its output. This is to ensure the server sends me data upon connecting.\n\nWhat I get with my Java code, though, is a warning from netty:\n\n> WARN io.reactivex.netty.protocol.http.internal.AbstractHttpConnectionBridge - Data received on channel, but no subscriber registered. Discarding data. Message class: io.netty.handler.codec.http.websocketx.TextWebSocketFrame, channel: [id: 0x905dd524, L:/10.100.42.2:51728 - R:gateway.discord.gg/104.16.59.37:443]\n\nWhat am I doing wrong here?\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/comments/258346873","html_url":"https://github.com/ReactiveX/RxNetty/issues/560#issuecomment-258346873","issue_url":"https://api.github.com/repos/ReactiveX/RxNetty/issues/560","id":258346873,"user":{"login":"NiteshKant","id":820005,"avatar_url":"https://avatars.githubusercontent.com/u/820005?v=3","gravatar_id":"","url":"https://api.github.com/users/NiteshKant","html_url":"https://github.com/NiteshKant","followers_url":"https://api.github.com/users/NiteshKant/followers","following_url":"https://api.github.com/users/NiteshKant/following{/other_user}","gists_url":"https://api.github.com/users/NiteshKant/gists{/gist_id}","starred_url":"https://api.github.com/users/NiteshKant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NiteshKant/subscriptions","organizations_url":"https://api.github.com/users/NiteshKant/orgs","repos_url":"https://api.github.com/users/NiteshKant/repos","events_url":"https://api.github.com/users/NiteshKant/events{/privacy}","received_events_url":"https://api.github.com/users/NiteshKant/received_events","type":"User","site_admin":false},"created_at":"2016-11-04T05:16:19Z","updated_at":"2016-11-04T05:16:19Z","body":"@sokolas sorry haven't got time yet to dig more into this but the issue is with [Ws7To13UpgradeHandler](https://github.com/ReactiveX/RxNetty/blob/0.5.x/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/ws/client/Ws7To13UpgradeHandler.java#L124) in which while removing `HttpClientCodec`, the message buffered in the codec is emitted first before the HTTP headers. "}}
{"actor":{"display_login":"NiteshKant"}}