filo_caspar/server/io/router.js

27 lines
634 B
JavaScript
Raw Normal View History

2016-04-10 08:37:05 +00:00
import logger from '../../log'
import { register, newConnection } from './connection'
import * as content from './content/routes'
2016-04-14 04:01:51 +00:00
import * as engine from './engine/routes'
import * as graphic from './graphic/routes'
import * as preset from './preset/routes'
2016-04-10 08:37:05 +00:00
function onConnection(server, data) {
const io = server.socket
const socket = data.socket
const log = logger.child({
id: socket.id,
})
let ctx = { io, socket, log }
newConnection(ctx)
register(ctx, 'content', content)
2016-04-14 04:01:51 +00:00
register(ctx, 'engine', engine)
register(ctx, 'graphic', graphic)
register(ctx, 'preset', preset)
2016-04-10 08:37:05 +00:00
}
export default onConnection