Skip to content
Discussion options

You must be logged in to vote

Hi, @csantos1113.

You can bypass an intercepted WebSocket connection by establishing the server connection in your event handler.

api.addEventListener('connection', ({ server }) => {
  server.connect()
})

Once you call server.connect(), all the client events will be forwarded to the original server, and all the server events will be forwarded to your client. Your handler becomes, effectively, a proxy sitting in-between where you can decide which events to intercept, modify, or prevent forwarding altogether.

Doing this in any matching handler will establish the connection to the original server. This means you don't have to call server.connect() in multiple event handlers matching the same…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@csantos1113
Comment options

@kettanaito
Comment options

@csantos1113
Comment options

@kettanaito
Comment options

@csantos1113
Comment options

Answer selected by kettanaito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants