Fork me on GitHub
#aleph
<
2017-07-29
>
kurt-o-sys23:07:28

I'm trying to connect to a WAMP/ws server, but can't seem to manage:

@(http/websocket-client ws-address)
io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response getStatus: 400 This server only speaks WebSocket subprotocols wamp.2.cbor.batched, wamp.2.cbor, wamp.2.msgpack.batched, wamp.2.msgpack, wamp.2.json.batched, wamp.2.json
Jul 30, 2017 1:19:51 AM clojure.tools.logging$eval1133$fn__1137 invoke
WARNING: error in websocket client
io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid subprotocol. Actual: wamp.2.json. Expected one of: null
	at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker.finishHandshake(WebSocketClientHandshaker.java:237)
	at aleph.http.client$websocket_client_handler$reify__19769.channelRead(client.clj:416)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	<...>
So, it seems I have to set the subprotocol (https://groups.google.com/forum/#!topic/aleph-lib/ulBaEd2YukY ?)
@(http/websocket-client ws-address {:headers {"Sec-WebSocket-Protocol" "wamp.2.json"}})
io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid subprotocol. Actual: wamp.2.json. Expected one of: null
Jul 30, 2017 1:23:18 AM clojure.tools.logging$eval1133$fn__1137 invoke
WARNING: error in websocket client
io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid subprotocol. Actual: wamp.2.json. Expected one of: null
	at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker.finishHandshake(WebSocketClientHandshaker.java:237)
	at aleph.http.client$websocket_client_handler$reify__19769.channelRead(client.clj:416)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	<...>

kurt-o-sys23:07:28

Can I set the ws subprotocol using Aleph? (and how?)