BuildNotification creates a lightweight JSON notification from a message.
(msg *identity.Message)
| 180 | |
| 181 | // BuildNotification creates a lightweight JSON notification from a message. |
| 182 | func BuildNotification(msg *identity.Message) []byte { |
| 183 | n := Notification{ |
| 184 | MessageID: msg.ID, |
| 185 | ConversationID: msg.ConversationID, |
| 186 | From: msg.Sender, |
| 187 | Recipient: msg.Recipient, |
| 188 | Subject: msg.Subject, |
| 189 | ReceivedAt: msg.CreatedAt, |
| 190 | } |
| 191 | data, _ := json.Marshal(n) |
| 192 | return data |
| 193 | } |
| 194 | |
| 195 | // readLoop blocks until the client disconnects or sends a close frame. |
| 196 | // It ignores client messages and sends periodic pings. |
no outgoing calls