Browse Source

Add "String" methods to ClientMessage/ServerMessage.

pull/115/head
Joachim Bauch 2 weeks ago
parent
commit
447fa9a279
No known key found for this signature in database GPG Key ID: 77C1D22D53E15F02
  1. 16
      api_signaling.go

16
api_signaling.go

@ -95,6 +95,14 @@ func (m *ClientMessage) CheckValid() error {
return nil
}
func (m *ClientMessage) String() string {
data, err := json.Marshal(m)
if err != nil {
return fmt.Sprintf("Could not serialize %#v: %s", m, err)
}
return string(data)
}
func (m *ClientMessage) NewErrorServerMessage(e *Error) *ServerMessage {
return &ServerMessage{
Id: m.Id,
@ -179,6 +187,14 @@ func (r *ServerMessage) IsParticipantsUpdate() bool {
return true
}
func (r *ServerMessage) String() string {
data, err := json.Marshal(r)
if err != nil {
return fmt.Sprintf("Could not serialize %#v: %s", r, err)
}
return string(data)
}
type Error struct {
Code string `json:"code"`
Message string `json:"message"`

Loading…
Cancel
Save