Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RealTime Messaging - Client not receiving messages

    Hi,
    We are using SmartGWT Version 5.0 Power Edition and I am testing using Chrome version 46.0.2490.86 m

    I am trying to use the Real Time Messaging module to send messages from the server side to the client, but the client does not receive any message.

    On the server side, everything looks good. I have included the isomorphic_js_parser.jar and isomorphic_realtime_messaging.jar into the server. Here is my code used to send the messages:
    Code:
    try
    {
      ISCMessageDispatcher.instance().send(new ISCMessage("59086B61-5326-491A-9D9E-0A73A04F9ABE", "test"));
    } 
    catch (Exception e)
    {
      e.printStackTrace();
    }
    This works fine as I can see the following log: “ISCMessageDispatcher - sending message to channel: 59086B61-5326-491A-9D9E-0A73A04F9ABE”

    On the client side, I have tried to include the RealTime Messaging module by adding this to my .gwt.xml project file:
    Code:
     
     <inherits name="com.smartgwt.RealtimeMessaging"/>
    When I then compile my project, I get the following error: Invoking Linker Cross-Site-Iframe [ERROR] The Cross-Site-Iframe linker does not support <script> tags in the gwt.xml files, but the gwt.xml file (or the gwt.xml files which it includes) contains the following script tags: sc/modules/ISC_RealtimeMessaging.js In order for your application to run correctly, you will need to include these tags in your host page directly. In order to avoid this error, you will need to remove the script tags from the gwt.xml file, or add this property to the gwt.xml file: <set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>
    As mentioned in the output, I have included the ISC_RealtimeMessaging.js directly into my .html file.
    Code:
     <script src="nfmportal/sc/modules/ISC_RealtimeMessaging.js"></script>
    I have also included the servlet-mapping into my web.xml as follow
    Code:
    <servlet>     
       <servlet-name>MessagingServlet</servlet-name>   
       <servlet-class>com.isomorphic.messaging.MessagingServlet</servlet-class>  
     </servlet>    
     <servlet-mapping>     
       <servlet-name>MessagingServlet</servlet-name>   
       <url-pattern>/nfmportal/sc/messaging/*</url-pattern>  
     </servlet-mapping>
    The code on the client-side looks like:
    Code:
     Messaging.subscribe("59086B61-5326-491A-9D9E-0A73A04F9ABE", new MessagingCallback() {   @Override   public void execute(Object data)   {     console.setContents(console.getContents() + (String)data);     } });
    I have also tested by setting a MessagingURL like this to match the URL pattern in the web.xml file.
    Code:
     Messaging.setMessagingURL("/nfmportal/sc/messaging/*")
    The only log I can see is in the access_log of tomcat where I see that the ISC_RealtimeMessaging.js is loaded correctly, but I don’t see any logs regarding the URL /nfmportal/sc/messaging/.

    Did I miss something?

    Thank you

    #2
    When you call Messaging.subscribe(), what happens to the request to the server? This is easy to determine by looking at the Developer Tools built into your browser (generally just hit F12 in Windows).

    It appears it's not hitting the Messaging servlet, so the URL is probably still not a match to where you've registered the MessagingServlet.

    Comment


      #3
      Hi, Thank you for your reply.

      It seems nothing special is happening into the console. On the network tab, I only see these:

      IDACall?isc_rpc=1&isc_v=v10.0p_2014-09-14&isc_xhr=1 200 xhr ISC_Core.js:1225 472 B 214 ms
      IDACall?isc_rpc=1&isc_v=v10.0p_2014-09-14&isc_xhr=1 200 xhr ISC_Core.js:1225 440 B 132 ms
      minimize.png 200 png Other 471 B 198 ms

      I don't see a log saying that the URL is not found or with a 404 error. Same in the access log file of tomcat.

      Comment


        #4
        OK, either you are not actually calling Messaging.send() at all, or your code crashed, or ISC_Messaging.js never actually loaded despite your attempts. All 3 should be straightforward to check on.

        Comment


          #5
          I have tried to check these 3 items. As mentioned above, on my server side, I call ISCMessageDispatcher.send(). I see in the logs that the message is sent to the good channel. Despite, I have changed my client side to help with the troubleshooting and I added a button that send a message using Messaging.send(). This still doesn't change anything, the message is not received.

          When my site is loading, the ISC_RealtimeMessage.js is loaded as I can see in the logs:
          10.9.25.100 - - [23/Nov/2015:19:42:10 -0500] "GET /nfmPortal/nfmportal/sc/modules/ISC_RealtimeMessaging.js HTTP/1.1" 200 4600 0.003 3 "http://10.9.25.104/nfmPortal/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"

          When my new button is clicked, I also display some parameters of the Messaging module as follow:
          Code:
                  SC.say("Realtime message module present: " + Messaging.messagingLoaded() + 
                         ". Message URL is: " + Messaging.getMessagingURL() + 
                         " Are we connected: " + Messaging.connected() + 
                         ", subscribed channels: " + test + 
                         ", timeout: " + Messaging.getConnectTimeout());
          The result is:
          Realtime message module present: true. Message URL is: /nfmportal/sc/messaging/* Are we connected: false, subscribed channels: , timeout: 4000

          So it looks like the module is loaded, but no channel is subscribed. I guess that my call to Messaging.subscribe() fails for some reason. Here is the code:
          Code:
              Messaging.setMessagingURL("/nfmportal/sc/messaging/*");
          
              Messaging.subscribe("test", new MessagingCallback()
              {
                @Override
                public void execute(Object data)
                {
                  console.setContents("TEST");  
                }
              });
              
              IButton testButton = new IButton(constants.close());
              testButton.addClickHandler(new ClickHandler()
              {
                @Override
                public void onClick(ClickEvent event)
                {
                  String[] channels = Messaging.getSubscribedChannels();
                  String test = "";
                  for (String channel : channels)
                  {
                    test = test + "," + channel;
                  }
                  
                  SC.say("Realtime message module present: " + Messaging.messagingLoaded() + 
                         ". Message URL is: " + Messaging.getMessagingURL() + 
                         " Are we connected: " + Messaging.connected() + 
                         ", subscribed channels: " + test + 
                         ", timeout: " + Messaging.getConnectTimeout());
                  
                  Messaging.send("test", "This is a test\n", new RPCCallback()
                  {
                    @Override
                    public void execute(RPCResponse response, Object rawData, RPCRequest request)
                    {
                      if (response.getStatus() != RPCResponse.STATUS_SUCCESS) 
                        SC.say("Failed send message to server.");  
                      else
                        SC.say("Message sent");
                    }
                  });
                }
              });

          Comment


            #6
            There has to be either an error or a request - there's no scenario in which the subscribe() process just silently stops.

            If there's a JavaScript error, it should be reported in the Developer Console, Eclipse console, or both.

            To eliminate the possibility that you have some kind of configuration or browser extension that is silently killing the request, try other browsers on the same machine, then another machine.

            Also check for basic mistakes such as having the browser Developer Tools open, but for the wrong tab - that kind of thing.

            Comment


              #7
              Thanks again for your help!

              I just saw in the Developer Console the following message:
              07:52:49.864:XRP9:WARN:Messaging:RealtimeMessaging not licensed - refusing to subscribe()
              07:52:56.701:MUP5:WARN:Messaging:RealtimeMessaging not licensed - refusing to send()

              Our complete version, from the developer console, is: v10.0p_2014-09-14/PowerEdition Deployment (built 2014-09-14)

              I have found this post that seems to be related: http://forums.smartclient.com/forum/...g-not-licensed

              I checked my ISC_Core.js file and the header looks ok, but I see this related to the Realtime Messaging:

              Code:
              RealtimeMessaging:{present:"false",name:"RealtimeMessaging Module"}
              From the post mentioned above, is it possible that we need to redownload the files again? Could it also be related to how I have included the module into my project: i.e without inherit but by including the javascript to my html page.

              Thank you

              Comment


                #8
                Remember, in the future, to always check the Developer Console first. This wasn't exactly a mysterious failure requiring us to both look through lots of diagnostics...

                As far as the problem, wherever you got this Power Edition build from, the account that downloaded it from SmartClient.com was not licensed for the Real Time Messaging module. At that point, it doesn't matter how or where you obtained the Real Time Messaging module, the problem is the base Power Edition build you're trying to add it to.

                What may have happened is that you purchased the new module, but are trying to use it with a build that pre-dates your purchase. Double-check that you've purchased the module (check with Isomorphic Sales if unsure), then get the latest patched build from smartclient.com/builds.

                Comment


                  #9
                  Hi Isomorphic,
                  I have double-checked yesterday our license and yes we did purchase the Real Time Messaging module. I am not the one who integrate SmartGWT into our project so I have to check with my team for that.

                  When you say get the latest patched build, is it only for RealTime Messaging module or I need to take everything ?

                  Thanks again

                  Comment


                    #10
                    You'll need to take everything. In general attempting to mix modules from different versions is always a bad idea as there are lots of interdependencies between how modules behave and many changes/fixes will span multiple pieces of the framework.

                    Regards
                    Isomorphic Software

                    Comment


                      #11
                      Thank you, we will try that as soon as possible and let you know if it fixes our issue.

                      Comment

                      Working...
                      X