- update return server instance farmisen
- update examples
- add
socket.broadcast
helper for broadcast emit
- update patch
app.listen
laggingreflex
- update use an http server if one already exists laggingreflex
- add allow passing options to socket.io instance
- update attach raw socket.io instance
- update attach IO instance for default namespace
- fix use new socket.io identifier type
- update dependencies
- fix attach IO instance and not the raw socket for namespaced instances
- koaSocket now attaches instances of itself to the
app
, whereas previously it attaches the socket.io instance. This facilitates accessingkoaSocket
instances from anyapp
middleware without having to pass it around as a dependency, the raw socket.io instance is still available askoaSocket.socket
. - The raw socket.io instance is now attached as
._io
, whilst the default namespace becomes.io
if it exists. - Made it explicit that
koaSocket
only supports node v4 as its lowest version.
- add namespace support
- add configure namespaces attaching to the app using
hidden
- add 1-arity constructor
- add allow runtime updates to middleware and listeners
- update test coverage
- add remove event listeners
- update use class notation
- update performance improvements by composing middleware in the socket constructor rather than every event
- add broadcast to all connections
- add test sling
- update throw error on failure to attach socket to koa
### Breaking changes
- koaSocket exposes an IO class, which must be instantiated. This is the same as instantiating a koa v2 app.
start
is renamed toattach
.Start
is misleading, more so thanattach
which at least does attach socket.io to a koa-callback-powered listener.- The context packet returned with each event now contains a Socket instance, rather than just the raw socket.io socket
- add koa v2 compatibility
- update middleware composition
- Middleware should now be passed
co
wrapped generators, similar to one method of using koa. - Context is shifted from
this
to thectx
parameter, which is passed through middleware to event listeners and is mutable.
- add - event to data packet - git-jiby-me
- add - explicit on and off connection callbacks
- fix - disconnect handler only once
- add - list of open connections
- add - remove a connection
- add - allow creation of middleware chain
- add - start server convenience function
- add - expose connected socket
- add - wrapper around attaching listeners to a socket instance