Skip to content

Instantly share code, notes, and snippets.

@conanak99
Created February 12, 2020 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conanak99/992e9205d5f84d67061a8cee8a208363 to your computer and use it in GitHub Desktop.
Save conanak99/992e9205d5f84d67061a8cee8a208363 to your computer and use it in GitHub Desktop.
import io from 'socket.io-client';
const socket = io('http://localhost:3002');
socket.on('connect', () => { console.log('connected') });
socket.on('newBet', function(newBet) {
const { id, name, avatar, bet, choice } = newBet;
const player = new Player(id, name, avatar);
store.dispatch('placeBet', { player, bet, choice });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment