MCPcopy Create free account
hub / github.com/koding/kite / ParsePayload

Method ParsePayload

protocol/webrtc.go:50–65  ·  view source on GitHub ↗

ParsePayload parses the payload if it is not parsed previously. This method can be called concurrently.

()

Source from the content-addressed store, hash-verified

48// ParsePayload parses the payload if it is not parsed previously. This method
49// can be called concurrently.
50func (w *WebRTCSignalMessage) ParsePayload() (*Payload, error) {
51 w.mu.Lock()
52 defer w.mu.Unlock()
53
54 if w.isParsed {
55 return w.parsedPayload, nil
56 }
57
58 payload := &Payload{}
59 if err := json.Unmarshal(w.Payload, payload); err != nil {
60 return nil, err
61 }
62
63 w.parsedPayload = payload
64 return payload, nil
65}
66
67// ParseWebRTCSignalMessage parses the web rtc command/message
68func ParseWebRTCSignalMessage(msg string) (*WebRTCSignalMessage, error) {

Callers 1

Calls 1

UnmarshalMethod · 0.80

Tested by 1