I’m not sure how to open a websocket connection, particularly in terms of authorizing it. I tried following the process used in the pyspeckle client (i.e. make a post request to ‘/accounts/login’ with credentials, then receive a token), but I get “Invalid credentials.” back.
Hey @tluther! I originally misinterpreted your question A wee bit confused - code you posted should work for getting your account token if local auth strategies are enabled on the server (currently most of them are).
I’ve also spotted a bug in the code linked there; I’m not authorising the connection with the token (this means that i’m not subscribing to events on private streams) to actually do that, the correct connection url should be:
this.ws = new sockette( `${wsUrl}?client_id=${this.$store.state.client._id}&access_token=${your_token}`, {
I’m using sockette, quite a nifty websocket lib that makes life quite a bit easier. Also the cutest js lib around probably.