Created
August 21, 2015 10:14
-
-
Save rubenCodeforges/6bc4114cf68bff542f3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('task12').factory('transportService', ['$q', function ($q) { | |
var URL = 'ws://********.com:4000/login'; | |
var ws = null; | |
function getConnectedWebSocket() { | |
//Здесь разрешено писать ваш код | |
} | |
function sendMessage (message) { | |
var deferred = $q.defer(); | |
var message = JSON.stringify(message); | |
getConnectedWebSocket().then(function (socket) { | |
//Здесь разрешено писать ваш код | |
}); | |
return deferred.promise; | |
} | |
return { | |
send: sendMessage | |
}; | |
}]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment