Skip to content

Commit

Permalink
examples update
Browse files Browse the repository at this point in the history
  • Loading branch information
igm committed Jun 12, 2014
1 parent 5a43e85 commit fb5eef3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 2 additions & 5 deletions examples/webchat/web/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
var origin = window.location.origin;
var sock = new SockJS(origin+'/echo', {
debug: true,
devel: true,
protocols_whitelist: "['websocket', 'xdr-streaming', 'xhr-streaming', 'iframe-eventsource', 'iframe-htmlfile', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']",
});

var sock = new SockJS(origin+'/echo')

document.getElementById("input").onkeydown= function (e) {
if (e.keyCode === 13) {
Expand Down
12 changes: 9 additions & 3 deletions examples/webecho/web/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
var origin = window.location.origin;
var sock = new SockJS(origin+'/echo', {

// options usage example
var options = {
debug: true,
devel: true,
protocols_whitelist: "['websocket', 'xdr-streaming', 'xhr-streaming', 'iframe-eventsource', 'iframe-htmlfile', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']",
});
protocols_whitelist: ['websocket', 'xdr-streaming', 'xhr-streaming', 'iframe-eventsource', 'iframe-htmlfile', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']
};

var sock = new SockJS(origin+'/echo', undefined, options);

document.getElementById("input").onkeydown= function (e) {
if (e.keyCode === 13) {
Expand All @@ -12,6 +16,7 @@ document.getElementById("input").onkeydown= function (e) {
};
};
document.getElementById("input").focus();

sock.onopen = function() {
console.log('connection open');
document.getElementById("status").innerHTML = "connected";
Expand All @@ -21,6 +26,7 @@ sock.onopen = function() {
sock.onmessage = function(e) {
document.getElementById("output").value += e.data +"\n";
};

sock.onclose = function() {
console.log('connection closed');
};
Expand Down

0 comments on commit fb5eef3

Please sign in to comment.