Created
October 17, 2019 20:40
-
-
Save simontabor/e2676524c5d570864a1891119470fae5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface InboundMessage { | |
room: string; | |
id: string; | |
data: object; | |
version: number; | |
} | |
ws.on('message', (rawMsg: string) => { | |
const messages: InboundMessage[] = JSON.parse(rawMsg); | |
console.log(messages); | |
/* | |
* [ | |
* { | |
* "room": "testing", | |
* "id": "1", | |
* "data": { "any": "info" }, | |
* "version": 1 | |
* } | |
* ] | |
*/ | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment