MCPcopy Create free account
hub / github.com/dank/rlapi / Close

Method Close

psynetrpc.go:65–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63}
64
65func (p *PsyNetRPC) Close() error {
66 p.mu.Lock()
67 if p.wsConn != nil && p.connected {
68 _ = p.wsConn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, ""))
69 err := p.wsConn.Close()
70
71 // clean up pending events
72 p.connected = false
73
74 if p.pingTimer != nil {
75 p.pingTimer.Stop()
76 p.pingTimer = nil
77 }
78
79 for reqID, ch := range p.pendingReqs {
80 close(ch)
81 delete(p.pendingReqs, reqID)
82 }
83
84 p.mu.Unlock()
85 p.sendEvent(EventTypeDisconnected, "")
86
87 return err
88 }
89
90 p.mu.Unlock()
91 return nil
92}
93
94func (p *PsyNetRPC) parseMessage(message string) (*PsyResponse, error) {
95 delimiter := "\r\n\r\n"

Callers 13

sendPingMethod · 0.95
readMessagesMethod · 0.95
postJSONMethod · 0.45
requestTokenMethod · 0.45
GetExchangeCodeMethod · 0.45
requestEOSTokenMethod · 0.45
RevokeEOSTokenMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 1

sendEventMethod · 0.95

Tested by

no test coverage detected