diff --git a/packages/server/packages/play-node-go/README.md b/packages/server/packages/play-node-go/README.md index 1a13540..2fb6864 100644 --- a/packages/server/packages/play-node-go/README.md +++ b/packages/server/packages/play-node-go/README.md @@ -1 +1,18 @@ -[Visit site](https://play-node-go.herokuapp.com/) \ No newline at end of file +# Node Go +A browser application to play Go in real time. + +## Development Demo +[The project in it's current state](https://play-node-go.herokuapp.com/) + +## Features +- [ ] Realtime communications +- [ ] Multiple game settings +- [ ] Customizable board size + + +## Built with +- [Express](https://expressjs.com) +- [React](https://reactjs.org) +- [PostgreSQL](https://postgresql.org) +- [Socket.io](https://socket.io) +- [Sass](https://sass-lang.com) diff --git a/packages/server/packages/play-node-go/play-node-go/src/io.js b/packages/server/packages/play-node-go/play-node-go/src/io.js index cdf0c7f..9be38ab 100644 --- a/packages/server/packages/play-node-go/play-node-go/src/io.js +++ b/packages/server/packages/play-node-go/play-node-go/src/io.js @@ -3,7 +3,7 @@ import config from './config'; const launch = (nsp, dispatch) => { const socket = socketIOClient(`${config.socketAddress}/${nsp}`); - + socket.on('connected', () => { dispatch({ type:'SOCKET', message:'CONNECTED', body:{nsp: socket.nsp} }); }); @@ -13,14 +13,14 @@ const launch = (nsp, dispatch) => { socket.on('error', err => { dispatch({ type: 'ERR', message:'SOCKET_ERROR', body: { socketError: err } }); }); - + socket.on('room_connected', (data) => { - dispatch({ type: 'ROOM', message: 'CONNECT_ROOM', body: data }); + dispatch({ type: 'ROOMS', message: 'CONNECT_ROOM', body: data }); }); - + socket.on('new_user', (data) => { console.log('new_user received') - dispatch({ type: 'ROOM', message: 'NEW_USER', body: data }) + dispatch({ type: 'ROOMS', message: 'NEW_USER', body: data }) }) return socket; diff --git a/packages/server/packages/play-node-go/play-node-go/src/reducers/rooms/stateReducer.rooms.js b/packages/server/packages/play-node-go/play-node-go/src/reducers/rooms/stateReducer.rooms.js index 6b35b08..577c868 100644 --- a/packages/server/packages/play-node-go/play-node-go/src/reducers/rooms/stateReducer.rooms.js +++ b/packages/server/packages/play-node-go/play-node-go/src/reducers/rooms/stateReducer.rooms.js @@ -25,8 +25,9 @@ export const roomsReducer = (state: state, action: action):state => { } case 'NEW_USER': { - console.log('hey') - console.log(action.data) + if (!action.data) { + return state; + } return state; }