Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RPCFunctions = struct { sync.RWMutex m RPCMap }{/* contains filtered or unexported fields */}
RPCFunctions stores the mapping of function names to function calls.
Functions ¶
func HandleWebSocket ¶
HandleWebSocket handles incoming WebSocket connections.
It upgrades the HTTP connection to the WebSocket protocol, reads JSON-RPC requests from the client, unmarshals the requests, calls the corresponding function, and sends the response back to the client.
func MarshalData ¶ added in v1.1.0
MarshalData encodes data into the specified format (either "json" or "msgpack").
func On ¶ added in v1.1.0
func On(name string, callback func(conn *wsconn.ConnectionWrapper, data interface{}))
On registers a callback function that will be executed when called via RPC.
func UnmarshalData ¶ added in v1.1.1
UnmarshalData decodes data into the specified format (either "json" or "msgpack").
Types ¶
Click to show internal directories.
Click to hide internal directories.