MCPcopy Create free account
hub / github.com/codecombat/codecombat / subOrUnsub

Function subOrUnsub

app/lib/websocket.js:16–25  ·  view source on GitHub ↗
(type, topics, ws)

Source from the content-addressed store, hash-verified

14 WebWS = self.WebSocket || self.MozWebSocket
15}
16const subOrUnsub = (type, topics, ws) => {
17 if (!Array.isArray(topics) && typeof topics === 'string') {
18 topics = [topics] // always send array
19 }
20 const msg = {
21 type,
22 topics
23 }
24 ws.send(JSON.stringify(msg))
25}
26
27module.exports = {
28 websocketUrl: (path) => {

Callers 1

websocket.jsFile · 0.85

Calls 1

stringifyMethod · 0.45

Tested by

no test coverage detected