( ctx context.Context, userID, roomID string, typing bool, timeoutMS int64, )
| 131 | } |
| 132 | |
| 133 | func (p *SyncAPIProducer) SendTyping( |
| 134 | ctx context.Context, userID, roomID string, typing bool, timeoutMS int64, |
| 135 | ) error { |
| 136 | m := &nats.Msg{ |
| 137 | Subject: p.TopicTypingEvent, |
| 138 | Header: nats.Header{}, |
| 139 | } |
| 140 | m.Header.Set(jetstream.UserID, userID) |
| 141 | m.Header.Set(jetstream.RoomID, roomID) |
| 142 | m.Header.Set("typing", strconv.FormatBool(typing)) |
| 143 | m.Header.Set("timeout_ms", strconv.Itoa(int(timeoutMS))) |
| 144 | |
| 145 | _, err := p.JetStream.PublishMsg(m, nats.Context(ctx)) |
| 146 | return err |
| 147 | } |
| 148 | |
| 149 | func (p *SyncAPIProducer) SendPresence( // 发送出席消息(比如进入某个房间) |
| 150 | ctx context.Context, userID string, presence types.Presence, statusMsg *string, |
no test coverage detected