frontend client for gemstone. decentralised workplace app
at main 657 B view raw
1import type { Did } from "@/lib/types/atproto"; 2import type { ShardMessage } from "@/lib/types/messages"; 3 4export const sendShardMessage = ( 5 { 6 content, 7 channel, 8 sentBy, 9 routedThrough, 10 }: { 11 content: string; 12 channel: string; 13 sentBy: Did; 14 routedThrough: Did; 15 }, 16 latticeSocket: WebSocket, 17) => { 18 const message: ShardMessage = { 19 type: "shard/message", 20 21 content, 22 channel, 23 sentBy, 24 routedThrough, 25 sentAt: new Date(), 26 }; 27 if (latticeSocket.readyState === WebSocket.OPEN) 28 latticeSocket.send(JSON.stringify(message)); 29};