Its not an html its a json. Any way found a way to implement my task without web socket.
Thanks & Regards Danushka Fernando Senior Software Engineer WSO2 inc. http://wso2.com/ Mobile : +94716332729 On Fri, May 20, 2016 at 7:35 PM, Manuranga Perera <m...@wso2.com> wrote: > Hi, > Seems like there is some issue with setting up the request level variables > when you reach from Web Socket path, looks like a bug. > But I am trying to understand why you are trying to return HTML from a > Web Socket. Shouldn't you be returning JSON ? > > On Fri, May 20, 2016 at 3:27 AM, Danushka Fernando <danush...@wso2.com> > wrote: > >> This only works with plain jaggery. Cant use inside any framework. >> Require function even doesn't work. >> >> Thanks & Regards >> Danushka Fernando >> Senior Software Engineer >> WSO2 inc. http://wso2.com/ >> Mobile : +94716332729 >> >> On Fri, May 20, 2016 at 11:46 AM, Danushka Fernando <danush...@wso2.com> >> wrote: >> >>> My log file rolled and tail got expired thats why I saw no logs. >>> Actually problem is my jaggery call to modules. I am getting exception >>> below. >>> >>> var logMap = mod.getFormattedRuntimeLogs(applicationKey, selectedRevision, >>> ""); >>> >>> Is there a way to ged rid of this? >>> >>> TID: [0] [AS] [2016-05-20 11:42:09,784] ERROR >>> {org.apache.coyote.AbstractProtocol$AbstractConnectionHandler} - Error >>> reading request, ignored {org.apache.co >>> yote.AbstractProtocol$AbstractConnectionHandler} >>> org.mozilla.javascript.WrappedException: Wrapped >>> java.util.NoSuchElementException (/appmgt/jagg/jagg.jag#377) >>> at >>> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754) >>> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148) >>> at >>> org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386) >>> at >>> org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63) >>> at >>> org.jaggeryjs.rhino.appmgt.jagg.c0._c_anonymous_37(/appmgt/jagg/jagg.jag:377) >>> >>> at org.jaggeryjs.rhino.appmgt.jagg.c0.call(/appmgt/jagg/jagg.jag) >>> at >>> org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32) >>> at >>> org.jaggeryjs.rhino.appmgt.modules.runtimeLogs.c0._c_anonymous_2(/appmgt/modules/runtimeLogs/module.jag:26) >>> >>> at >>> org.jaggeryjs.rhino.appmgt.modules.runtimeLogs.c0.call(/appmgt/modules/runtimeLogs/module.jag) >>> >>> at >>> org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52) >>> at >>> org.jaggeryjs.rhino.appmgt.site.blocks.runtimeLogs.ws.c0._c_anonymous_1(/appmgt/site/blocks/runtimeLogs/ws/runtimeLogs.jag:37) >>> >>> at >>> org.jaggeryjs.rhino.appmgt.site.blocks.runtimeLogs.ws.c0.call(/appmgt/site/blocks/runtimeLogs/ws/runtimeLogs.jag) >>> >>> at >>> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394) >>> at >>> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091) >>> at >>> org.jaggeryjs.rhino.appmgt.site.blocks.runtimeLogs.ws.c0.call(/appmgt/site/blocks/runtimeLogs/ws/runtimeLogs.jag) >>> >>> at >>> org.jaggeryjs.hostobjects.web.WebSocketHostObject.processText(WebSocketHostObject.java:139) >>> >>> at >>> org.jaggeryjs.jaggery.core.websocket.WSMessageInBound.onTextMessage(WSMessageInBound.java:36) >>> >>> at >>> org.apache.catalina.websocket.MessageInbound.onTextData(MessageInbound.java:74) >>> >>> at >>> org.apache.catalina.websocket.StreamInbound.doOnTextData(StreamInbound.java:186) >>> >>> at >>> org.apache.catalina.websocket.StreamInbound.onData(StreamInbound.java:134) >>> at >>> org.apache.coyote.http11.upgrade.UpgradeProcessor.upgradeDispatch(UpgradeProcessor.java:83) >>> >>> at >>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:587) >>> >>> at >>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653) >>> >>> at >>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) >>> >>> at >>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) >>> >>> at java.lang.Thread.run(Thread.java:744) >>> Caused by: java.util.NoSuchElementException >>> at java.util.Vector.lastElement(Vector.java:499) >>> at >>> org.jaggeryjs.jaggery.core.manager.WebAppManager.executeScript(WebAppManager.java:226) >>> >>> at >>> org.jaggeryjs.jaggery.core.manager.WebAppManager.require(WebAppManager.java:318) >>> >>> at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source) >>> at >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >>> >>> at java.lang.reflect.Method.invoke(Method.java:606) >>> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126) >>> ... 24 more >>> >>> Thanks & Regards >>> Danushka Fernando >>> Senior Software Engineer >>> WSO2 inc. http://wso2.com/ >>> Mobile : +94716332729 >>> >>> On Fri, May 20, 2016 at 11:18 AM, Danushka Fernando <danush...@wso2.com> >>> wrote: >>> >>>> This is my server side looks like >>>> >>>> >>>> <% >>>> /* >>>> * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. >>>> * >>>> * WSO2 Inc. licenses this file to you under the Apache License, >>>> * Version 2.0 (the "License"); you may not use this file except >>>> * in compliance with the License. >>>> * You may obtain a copy of the License at >>>> * >>>> * http://www.apache.org/licenses/LICENSE-2.0 >>>> * >>>> * Unless required by applicable law or agreed to in writing, >>>> * software distributed under the License is distributed on an >>>> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >>>> * KIND, either express or implied. See the License for the >>>> * specific language governing permissions and limitations >>>> * under the License. >>>> */ >>>> >>>> include("/jagg/jagg.jag"); >>>> include("/jagg/constants.jag"); >>>> >>>> var mod, obj, >>>> log = new Log(), >>>> action = request.getParameter("action"), >>>> site = require("/site/conf/site.json"); >>>> >>>> var applicationKey = request.getParameter("applicationKey"); >>>> var selectedRevision = request.getParameter("selectedRevision"); >>>> var mod = jagg.module("runtimeLogs"); >>>> webSocket.onbinary = function (data) { >>>> log.info('Client Sent : ' + data); >>>> var ws = this; >>>> var logMap = mod.getFormattedRuntimeLogs(applicationKey, >>>> selectedRevision, ""); >>>> ws.send(logMap); >>>> }; >>>> webSocket.ontext = function (data) { >>>> log.info('Client Sent : ' + data); >>>> var ws = this; >>>> var logMap = mod.getFormattedRuntimeLogs(applicationKey, >>>> selectedRevision, ""); >>>> ws.send(logMap); >>>> }; >>>> %> >>>> >>>> And this is my client side >>>> >>>> ws = new >>>> WebSocket("wss://localhost:9443/appmgt/site/blocks/runtimeLogs/ws/runtimeLogs.jag?action=getSnapshotLogs&applicationKey=" >>>> + applicationKey + "&selectedRevision=" + >>>> selectedRevision); >>>> >>>> //event handler for the message event in the case of text frames >>>> ws.onmessage = function(event) { >>>> //some work >>>> }; >>>> >>>> setTimeout(function() {ws.send(""); console.log("dddd");}, 60000); >>>> >>>> >>>> I can see the console log for send but no logs in server side. Whats I >>>> am doing wrong here? >>>> >>>> Thanks & Regards >>>> Danushka Fernando >>>> Senior Software Engineer >>>> WSO2 inc. http://wso2.com/ >>>> Mobile : +94716332729 >>>> >>>> On Fri, May 20, 2016 at 9:59 AM, Manjula Rathnayake <manju...@wso2.com> >>>> wrote: >>>> >>>>> Hi all, >>>>> >>>>> Does web sockets work through nginx, haproxy like load balancers? >>>>> >>>>> thank you. >>>>> >>>>> On Fri, May 20, 2016 at 9:37 AM, Sinthuja Ragendran <sinth...@wso2.com >>>>> > wrote: >>>>> >>>>>> Hi Dhanushka, >>>>>> >>>>>> You don't need to do any special changes, just include the server >>>>>> side code as shown in the sample [1] in a jag file, and mention that jag >>>>>> URL in the client side to connect via web socket. As per the example, the >>>>>> jaggery app for ws server side should be in below format. >>>>>> >>>>>> - sample >>>>>> - ws >>>>>> - server.jag >>>>>> >>>>>> Thanks, >>>>>> Sinthuja. >>>>>> >>>>>> >>>>>> On Fri, May 20, 2016 at 9:26 AM, Danushka Fernando < >>>>>> danush...@wso2.com> wrote: >>>>>> >>>>>>> Hi >>>>>>> I tried to follow [1] to use some web sockets. But server url has to >>>>>>> be in either ws or wss protocols. How we can expose a jaggery app in >>>>>>> these >>>>>>> protocols? >>>>>>> >>>>>>> [1] http://jaggeryjs.org/documentation.jag?api=webSocket >>>>>>> >>>>>>> Thanks & Regards >>>>>>> Danushka Fernando >>>>>>> Senior Software Engineer >>>>>>> WSO2 inc. http://wso2.com/ >>>>>>> Mobile : +94716332729 >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Dev mailing list >>>>>>> Dev@wso2.org >>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Sinthuja Rajendran* >>>>>> Associate Technical Lead >>>>>> WSO2, Inc.:http://wso2.com >>>>>> >>>>>> Blog: http://sinthu-rajan.blogspot.com/ >>>>>> Mobile: +94774273955 >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Manjula Rathnayaka >>>>> Associate Technical Lead >>>>> WSO2, Inc. >>>>> Mobile:+94 77 743 1987 >>>>> >>>> >>>> >>> >> > > > -- > With regards, > *Manu*ranga Perera. > > phone : 071 7 70 20 50 > mail : m...@wso2.com >
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev