Skip to content

Instantly share code, notes, and snippets.

const connection = new WebSocket(config.pubsub.url);
connection.onopen = () => {
connection.send({
subscribe: {
channel: this.state.user.get('language'),
user: {
id: this.state.user.id // Could be named 'username' instead
data: {} // Attach custom data to a user
}
}
const connection = new WebSocket(config.pubsub.url);
connection.onopen = () => {
connection.send({
login: {
username: this.state.user.id
}
});
connection.send({
subscribe: {