Skip to content

Instantly share code, notes, and snippets.

@EderRoger
Created July 2, 2014 17:49
Show Gist options
  • Save EderRoger/3a97c96f22f5a676a82c to your computer and use it in GitHub Desktop.
Save EderRoger/3a97c96f22f5a676a82c to your computer and use it in GitHub Desktop.
RequireJS Socket.io client config
require.config({
urlArgs: "bust=" + (new Date()).getTime(),
paths: {
angularSocketIO: '../../lib/angular-socket-io/socket',
socketio: 'http://127.0.0.1:8001/socket.io/socket.io.js'
},
shim: {
'angular': {'exports': 'angular'},
"angularSocketIO": ['angular'],
"socketio": {
exports: 'io'
}
},
priority: [
"angular"
]
});
require(
[
'angular',
'bootstrap',
'routes'
],
function (angular) {
'use strict';
angular.element(document).ready(function() {
angular.bootstrap(document, ['app']);
});
});
define(['angular','socketio'], function (angular,io) {
'use strict';
/* Services */
angular.module('app.services', [])
.factory('socket', function (socketFactory) {
return socketFactory({
prefix: 'foo~',
ioSocket: io.connect('localhost:8001')
});
})
;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment