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
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to