angular socket.io plugin, with mini configuration and api
- no need to include socket.io.js
- auto apply event callbacks
bower install -S tommy-angular-socket-io
or downloadtomSocket.service.js
manually- Insert
<script src="/path/to/your/tomSocket.service.js"></script>
after angular.js
- Add
tomSocket
as your module dependency - config your module with
SocketProvider.pathToServer = 'path/to/your/real/socket/server'
- Inject
Socket
as a service and use it like this, just like original socket.io:
Socket.on('eventName', function (data) {
// do something with data
});
Socket.emit('eventName', data);