Skip to content

Connect to Autobahn with Subscribe #33

Description

@yozef

I would like to connect to a websocket server (Autobahn), and then subscribe to a channel.

When I use this lib:

websocket = new WebSocket("wss://api.domain.com", "*", "wsservice");
				
websocket.addEventListener(WebSocketEvent.CLOSED, handleWebSocketClosed);
websocket.addEventListener(WebSocketEvent.OPEN, handleWebSocketOpen);
websocket.addEventListener(WebSocketEvent.MESSAGE, handleWebSocketMessage);
websocket.addEventListener(WebSocketErrorEvent.CONNECTION_FAIL, handleConnectionFail);
				
websocket.connect();

--- then ---
protected function handleWebSocketOpen(event:WebSocketEvent):void {
	websocket.sendUTF(JSON.stringify({
		"type": "subscribe",
		"channels": ['channel']
	}));
}

However when I try to connect, I get the following error:

I DONT KNOW HOW TO HANDLE DER stuff of TYPE 12
Connection Failure: An HTTP response code other than 101 was received.  Actual Response Code: 400 HTTP Origin header invalid: No host part in Origin '*'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions