Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbdk committed Jul 30, 2019
1 parent 25107cf commit f9b6401
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@

A client centric websocket service that lets the clients put anything on a shared websocket 'table'.

It is inspired by redux, and my desire to rapidly prototype browserbased multiplayer games.
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?
4 changes: 3 additions & 1 deletion src/public.reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ module.exports = function(state, action) {
...action.data[k]
];
} else {
clientState[k] = action.data[k];
clientState[k] = typeof(clientState[k]) === 'object'
? { ...clientState[k], ...action.data[k] }
: action.data[k];
}
});

Expand Down
8 changes: 8 additions & 0 deletions src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ const connectionReducer = require('./connection.reducer');
const publicReducer = require('./public.reducer');
const { publicEffect, timesyncEffect } = require('./effects');

// @TODO, How to auth?
// @TODO, Binary data events?
// @TODO, Table domains
// @TODO, Rename public to table
// @TODO, Initial state sharing
// @TODO, Reducer sharing???
// @TODO, API exploration, how?

module.exports = function ({ initialState = {}, customReducer = a => a, effects = [], pingInterval = 30000 }) {
const router = new Router();
const app = websockify(new Koa());
Expand Down

0 comments on commit f9b6401

Please sign in to comment.