Skip to content

Commit

Permalink
Merged with head
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbdk committed Aug 17, 2019
2 parents 8d7614b + 5a1d899 commit 49230ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ A client centric websocket service that lets the clients put anything on a share

It is inspired by redux, and my desire to rapidly prototype browserbased multiplayer games.


# Todo
* Scopes, server-private scopes
* Private actions, add "public:set", "public:set:all" etc.
* Multiple reducers?
* Add XSS protection and fix the lodash securety issue..
9 changes: 3 additions & 6 deletions src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,12 @@ module.exports = function ({ initialState = {}, reducers = {}, effects = [], pin

ctx.websocket.on('message', (rawReq) => {
const req = JSON.parse(rawReq);

const allowed = allowedActions.reduce((acc, curr) => {
return acc || (req.type.indexOf(curr) > -1)
}, false)
const allowed = allowedActions.indexOf(req.type) > -1;

if(allowed) {
store.dispatch({
type: req.type ? req.type : 'message',
data: req.data ? req.data : rawReq,
type: req.type,
data: req.data,
socket: ctx.websocket
});
}
Expand Down

0 comments on commit 49230ea

Please sign in to comment.