Skip to content

Instantly share code, notes, and snippets.

@jrthib
jrthib / AnotherController.js
Created July 16, 2014 23:50
Factory using promises to start the socket.io authentication and session after logging into an Angular app.
(function() {
'use strict';
function AnotherController($scope, socket) {
// use the socket factory through your app, but you must use socket.then
// so that the actions occur once the socket is established
socket.then(function(socket) {
socket.emit('some_socket_event', {});
});