How to receive messages in a GWT App using Kaazing Websockets <type>proxy</type> configuration? -


I am trying to create a GWT (2.4.0) application that communicates (full-duplex) to a server To accomplish this, a text-based protocol, I am using Consson WebSocket Gateway version 3.3.2 as a proxy.

GWT app & lt; ----- [websocket] -----> Qazing & lt; ----- [TCP] -----> Backend Server

This is my casing configuration:

  & Lt; Services & gt; & Lt; Accept & gt; Ws: //127.0.0.1: 9444 / foobar & lt; / Accept & gt; & Lt; Connect & gt; TCP: // Local Host: 50,189 & lt; / Connect & gt; & Lt; Type & gt; Proxy & lt; / Type & gt; & Lt; Cross-site-barrier & gt; & Lt; Allowing the original & gt; Http: //127.0.0.1: 8888 & lt; / Basic to allow & gt; & Lt; / Cross-site-barrier & gt; & Lt; / Services & gt;  

This setup works with the Java implementation of the Caging Client. Now I want to use this service in the GWT application.

This is my code for GWT client implementation:

  websacet; Try {ws = new web site ("ws: //127.0.0.1: 9444 / Fubar"); Ws.addCloseHandler (New CloseHandler) {@ Override Public Wide On Close (CloseEvent Ev) {}}); Ws.addMessageHandler (new messenger handler) {@Override Message on Public Zero (Message Event Event) {System.out.println (ev.getData ())}}}); Ws.addOpenHandler (new OpenHandler () {@ Override Public Open on OpenEvent (openEvent) {}}); } Hold (WebSocketException e) {e.printStackTrace (); }  

The GWT client can successfully send the text to the backend server. It can not react to the server as soon as called ev.getgeta () , Javascript throws an exception.

  Uncustom JavaScript exceptions [Unusual java.lang.ClassCastException: com.google.gwt. Core.client.JavaScriptObject $ can not be entered on java.lang.String]  

If I change the WebSocket address in the code at ws: //127.0.0.1: 9444 To use the echo / resonance Caging Echo service, the text I have sent has been successfully received by the GWT application. If I change the service to proxy (or broadcast ), then the above JavaScript exception is thrown every time the message is received from the server.

The same code in the Java program (using the Kazan Java client) works just fine.

As I am not a GWT expert, there is no way that I can debug this problem or is there a simple solution that I just fail to see?

I believe I have seen that issue before, whether you share your gwtclient.gwt Do you agree to the .xml file contents? Or, depending on whether you are using a bytesocket or websacet in the 'Gwtclient.gwt.xml' of GWT client, depending on whether you try to add '' or ''.

Hope this helps,

-Marcelo


Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -