A few days ago we published an example demonstrating .NET data push to a native iPhone application. In that example the backend service was a .NET application hosted in WebORB for .NET. The application used WebORB as an RTMP server to deliver real-time updates to the client devices. In addition to the RTMP clients (like an iOS devices or cialis without prescription Flex apps), a slightly modified version of the same code can easily support clients connecting via publish/subscribe API. An example of a such client can be a native Android application using our client-side library. We put together a native Android application and extended the server-side code to support publish/subscribe clients. The video below demonstrates the example in action and provides a brief code review. The instructions for setting up and running the example follow the video.
Follow the steps below to deploy and run the example:
- Download and install the latest version of WebORB for .NET. (This post assumes the product is installed in the default installation directory. For the version 4.4, the installation directory is: c:/Program Files/WebORB for .NET/4.4.0.0/)
- Download the client-side project from:
http://examples.themidnightcoders.com/blog/StockExchangeAndroidClient.zip - Download the server-side project from:
http://examples.themidnightcoders.com/blog/StockExchangeWithPubSub-server.zip - Open the server-side project in Visual Studio. Compile the project and make sure the compiled assembly is copied into the /bin folder in the WebORB installation directory (c:/Program Files/WebORB for .NET/4.4.0.0/bin)
- Open messaging-config.xml from c:/Program Files/WebORB for .NET/4.4.0.0/WEB-INF/flex in a text editor.
- Add the following XML block before the closing </service> tag:
<br /> <destination id="StockExchangeDestination"><br /> <properties><br /> <server><br /> <durable>false</durable><br /> </server><br /> <message-service-handler>Weborb.Messaging.PubSub.Memory.MessagingServiceHandler</message-service-handler><br /> <message-storage-policy>Weborb.Messaging.PubSub.Memory.MemoryStoragePolicy</message-storage-policy><br /> </properties><br /> <channels><br /> <channel ref="my-polling-amf" /><br /> </channels><br /> </destination><br /> - Create “StockExchange” directory under the “Applications” folder located at: c:/Program Files/WebORB for .NET/4.4.0.0/Applications)
- Create the app.config file in the StockExchange directory with the following contents:
<br /> <?xml version="1.0" encoding="utf-8"?><br /> <configuration><br /> <application-handler>StockExchange.AppHandler</application-handler><br /> </configuration><br />
- Compile and run the Android project. Once the client application runs enter the WebORB remoting endpoint URL (for example for the local installation it may be http://localhost/weborb4/weborb.aspx). Click the ‘Connect’ button to establish a connection with the server-side application.
