MCPcopy
hub / github.com/tinode/chat / serialize

Method serialize

server/session.go:1372–1386  ·  view source on GitHub ↗
(msg *ServerComMessage)

Source from the content-addressed store, hash-verified

1370}
1371
1372func (s *Session) serialize(msg *ServerComMessage) (int, any) {
1373 if s.proto == GRPC {
1374 msg := pbServSerialize(msg)
1375 // TODO: calculate and return the size of `msg`.
1376 return -1, msg
1377 }
1378
1379 if s.isMultiplex() {
1380 // No need to serialize the message to bytes within the cluster.
1381 return -1, msg
1382 }
1383
1384 out, _ := json.Marshal(msg)
1385 return len(out), out
1386}
1387
1388// onBackgroundTimer marks background session as foreground and informs topics it's subscribed to.
1389func (s *Session) onBackgroundTimer() {

Callers 4

ShutdownMethod · 0.80
EvictUserMethod · 0.80
replyDelUserFunction · 0.80

Calls 2

isMultiplexMethod · 0.95
pbServSerializeFunction · 0.85

Tested by

no test coverage detected