I'm trying to get a working example, similar to the simple chat example in order to evaluate the SmartClient Real-Time Messaging. The JavaDocs don't appear to include the classes noted in the messaging quick reference. For example, I'm sure I will need to extend the ISCMessageDispatcher, and a few other classes to get my prototype working. How can I get a hold of the JavaDocs for these classes (com.isomorphic.messaging), or the source of the server code for the simple chat example?
Announcement
Collapse
No announcement yet.
X
-
Hi gmccone -
Right - the javadocs don't include these classes at the moment, but the Real-Time Messaging Quick Reference does include the public APIs and extension points of all the relevant classes.
The messaging example in the SDK (examples/messaging/simple_chat.jsp) does not require server-side code. It works with the built-in MessagingServlet, creating a "simple mode" dispatcher (com.isomorphic.messaging.LocalMessageDispatcher) via the configuration found in server.properties.
If you're running in enterprise mode (using JMS) then you can send messages to browser-based subscribes by simply publishing messages to a topic named after a channel via standard JMS APIs. You can subscribe to browser messages by subscribing to a topic named after a channel, again via standard JMS APIs.
You can also send messages from the server, in either simple or enterprise mode, via e.g:
Code:ISCMessageDispatcher messageDispatcher = ISCMessageDispatcher.instance(); // can also pass a List of channels. "myData" can be any Object messageDispatcher.send(new ISCMessage("myChannel", "myData");
Code:ISCMessageDispatcher messageDispatcher = ISCMessageDispatcher.instance(); ISCSubscriber subscriber = new ISCSubscriber(); messageDispatcher.subscribe(subscriber, "myChannel"); while (true) { int timeout = 1000; // blocks until next message arrives, or timeout ms elapses ISCMessage message = subscriber.nextMessage(timeout); if (message != null) { Object data = message.getData(); // do something with the message data... } }
Last edited by Isomorphic; 7 Mar 2007, 17:25.
-
The "data" argument is translated to JavaScriptObjects by the same process as is documented for dsResponse/rpcResponse.data.
As far as SmartGWT, it does not use GWT-RPC or similar processes - the data arrive as JavaScriptObjects which you can then use JSOHelper APIs to turn into Records or other client-side objects.
Comment
-
Hi.
How about new ISCMessage(List arg0, Object arg1, String arg2)
what is String arg2? we should know those arg0 is for List of channel and arg1 for object to send.
i cannot find any information/API in Messaging_QuictRef.pdf (version 6.5). what was the purpose for that parameter used for?
currently i use the new ISCMessage(List arg0, Object arg1) and it works fine.
just wonder...Last edited by gtr_ommar; 8 Sep 2010, 20:30.
Comment
Comment