Skip to content

Sockethelper

Max edited this page Jun 7, 2021 · 1 revision

This creates the websocket connection and sending data to clients.

WsEndpoint

This method upgrades an http connection to a websocket connection.
This method takes an http.Reponsewriter and a (pointer to) http.Request as parameters
This method returns a websocket connection and an error (if an error occured)
Sample Usage:

var  wsConn, err = SocketHelper.WsEndpoint(httpResp, httpReq)

Sender

This method sends a payload over a given socket connection.
The parameters for this method are the client connection (as a pointer) and a message to send (in the form of an [ReturnMessage](Server Package)).
The method returns an error or nil.
Sample Usage:

Sender(client.Conn, message)
Clone this wiki locally