MCPcopy
hub / github.com/coder/websocket / OnOpen

Method OnOpen

internal/wsjs/wsjs_js.go:131–133  ·  view source on GitHub ↗

OnOpen registers a function to be called when the WebSocket is opened.

(fn func(e js.Value))

Source from the content-addressed store, hash-verified

129
130// OnOpen registers a function to be called when the WebSocket is opened.
131func (c WebSocket) OnOpen(fn func(e js.Value)) (remove func()) {
132 return c.addEventListener("open", fn)
133}
134
135// Close closes the WebSocket with the given code and reason.
136func (c WebSocket) Close(code int, reason string) (err error) {

Callers 1

dialFunction · 0.80

Calls 1

addEventListenerMethod · 0.95

Tested by

no test coverage detected