public/puggernaut.js in puggernaut-0.2.0 vs public/puggernaut.js in puggernaut-0.2.1

- old
+ new

@@ -2,26 +2,26 @@ var $ = jQuery; var self = this; this.disabled = false; + this.host = window.location.host; this.path = '/long_poll'; + this.port = 8102; this.inhabitants = inhabitants; this.unwatch = unwatch; this.watch = watch; this.watch_join = watch_join; this.watch_leave = watch_leave; - this.webSocketPort = webSocketPort; var channels = {}; var errors = 0; var events = $('<div/>'); var leaves = {}; var started = false; var request; var request_id; - var port = 8102; function ajax(join_leave, time, user_id) { if (channelLength() > 0 && !self.disabled && errors <= 10) { started = true; request = $.ajax({ @@ -188,11 +188,11 @@ } function websocket(join_leave, time, user_id) { if (channelLength() > 0 && !self.disabled && errors <= 10) { started = true; - request = new WebSocket("ws://" + window.location.host + ":" + webSocketPort() + "/"); + request = new WebSocket("ws://" + self.host + ":" + self.port + "/"); request.onopen = function() { errors = 0; if (started) request.send($.param(params(join_leave, time, user_id), true)); }; @@ -213,12 +213,7 @@ request.onclose = function() { if (started) websocket(join_leave, null, user_id); }; } - } - - function webSocketPort(p) { - if (p) port = p; - return port; } }; \ No newline at end of file