diff --git a/LuaPlayground/build/debug/main.js b/LuaPlayground/build/debug/main.js index e77eb75..9cb6762 100644 --- a/LuaPlayground/build/debug/main.js +++ b/LuaPlayground/build/debug/main.js @@ -270,14 +270,13 @@ } run() { - var me, proto, value; + var me, value; me = this; value = this.editor.getValue().trim(); if (!(value && value !== "")) { return; } - proto = window.location.protocol === "https:" ? "wss://" : "ws://"; - this.socket = new WebSocket(proto + this._api.HOST + "/system/apigateway?ws=1"); + this.socket = this.stream(); this.socket.onopen = function() { //send data to server return me.socket.send(JSON.stringify({ diff --git a/LuaPlayground/coffees/main.coffee b/LuaPlayground/coffees/main.coffee index ebcb7f1..e6f098c 100644 --- a/LuaPlayground/coffees/main.coffee +++ b/LuaPlayground/coffees/main.coffee @@ -193,8 +193,7 @@ class LuaPlayground extends this.OS.GUI.BaseApplication me = @ value = @editor.getValue().trim() return unless value and value isnt "" - proto = if window.location.protocol is "https:" then "wss://" else "ws://" - @socket = new WebSocket proto + @_api.HOST + "/system/apigateway?ws=1" + @socket = @stream() @socket.onopen = () -> #send data to server me.socket.send( JSON.stringify { code: value } )