Skip to content

Commit

Permalink
Merge pull request wilk#12 from zetsubo/master
Browse files Browse the repository at this point in the history
fix null protocol argument bug
  • Loading branch information
wilk committed Dec 17, 2014
2 parents df74ffd + 50e3fce commit ecbdac7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ng-websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,16 @@
};

me.$$init = function (cfg) {
me.$$ws = cfg.mock ? new $$mockWebsocket(cfg.mock, $http) : new WebSocket(cfg.url, cfg.protocols);

if (cfg.mock) {
me.$$ws = new $$mockWebsocket(cfg.mock, $http);
}
else if (cfg.protocols) {
me.$$ws = new WebSocket(cfg.url, cfg.protocols);
}
else {
me.$$ws = new WebSocket(cfg.url);
}

me.$$ws.onmessage = function (message) {
try {
Expand Down

0 comments on commit ecbdac7

Please sign in to comment.