Building a transparent proxy for websockets connections

555 views
Skip to first unread message

Ángel Nohara

unread,
Nov 5, 2018, 12:17:23 PM11/5/18
to Gorilla web toolkit
Hi all,

First of all, thanks for the all the work behind the Gorilla websockets project. I just discovered it and looks really nice.

Here it goes my question, I want to build a proxy for the whole websocket communication (including the protocol upgrade by HTTP). I have an application that communicates using websockets. The messages are sent using an specific binary format, so in my code I want to do the following process:

  1. Handle the connection process in HTTP, verifying the headers sent in the first HTTP connection.
  2. For every subsequent websocket message, parse the binary structure (I already have a function for parsing it), modify a string value and send it to the original destination in the binary format again.

I'm a bit lost in how to just intercept the websocket connection and access to the binary data.

Matt S

unread,
Nov 6, 2018, 10:05:16 AM11/6/18
to goril...@googlegroups.com
Take a look at https://github.com/gorilla/websocket/tree/master/examples/chat (and the other examples) - gorilla/websocket handles upgrading of the connection for you.

Parsing and then connecting to an upstream server can be done with the client APIs in the library.

--
You received this message because you are subscribed to the Google Groups "Gorilla web toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gorilla-web...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages