So far, it has been a challenge for us working with HTML5 WebSocket to analyze the traffic going back and forth from the client to the server and from the server to the client. Without using packet sniffing tools like Wireshark or tcpdump the analysis and debugging of WebSocket messages is almost impossible.
But, recently, things are changing and it's now possible to see frame data along with arrows indicating the direction of the data is going to.
A WebKit patch has been created and you can use Chrome Canary to check the latest changes and start inspecting WebSocket frames. A huge advance for those working with HTML5 WebSocket.
There is also a step-by-step demo located here: http://blog.kaazing.com/2012/05/09/inspecting-websocket-traffic-with-chrome-developer-tools/
Thursday, May 10, 2012
Monday, April 30, 2012
Accessing Databases with HTML5 WebSockets and Apache Camel
As I have said on my previous post, I've been working with several companies with the most diverse use cases and one that really brought my attention was the requirement to access databases using HTML5 WebSockets which seems to be a clever thing to do with the right tools.
So, basically what I've setup for this is represented on the picture below:
UDPATE:
Sample code is now available at: https://github.com/mjabali/DBOverWS
So, basically what I've setup for this is represented on the picture below:
Let's go over the implementation details of all of the components described here:
From right to left, the backend datasource I had to use was MySQL that you can download from http://www.mysql.com/downloads/. Then, I used Apache Camel as the backend framework accessing the database and also exposing a TCP-based component (Mina in this case). Moving to the left, we have the Kaazing WebSocket Gateway connecting to the Apache Camel framework and exposing WebSocket connectivity to the web clients (browser-based, mobile-based and desktop thick client applications).
The web-browser sample client is pretty straightforward and with a few lines of code you can get the functionality. There are sample javascript clients shipped with the Kaazing WebSocket Gateway that you can re-use or modify to your needs. The Kaazing WebSocket Gateway documentation set is also helpful and good starting point. Check it out: http://tech.kaazing.com/documentation/html5/3.3/o_dev_js.html
Then the only change you have to make in the Kaazing WebSocket Gateway is in the gateway-config.xml (under $KWG_HOME/conf) to include the service you want to expose to the web clients and where you want to connect to the backend framework with access to the database.
Here is what I have included on my configuration:
<!-- Demo JDBC Backend System Config -->
<!-- Proxy service -->
<service>
<accept>ws://${gateway.hostname}:${gateway.extras.port}/jdbc</accept>
<type>proxy</type>
<properties>
<connect>tcp://${gateway.hostname}:8888</connect>
</properties>
</service>
Check the Kaazing WebSocket Gateway documentation to get more familiar with these settings.
Last but not least, the Apache Camel route hosting the Mina endpoint and the database connectivity:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<package>com.kaazing.gateway.demo.db</package>
<route id="WSMinaJDBCSample">
<from uri="mina:tcp://localhost:8888?timeout=30000"/>
<log message="RECEIVED: ${body}"/>
<setBody>
<simple>select * from customers where customers.email = '${body}'</simple>
</setBody>
<to uri="jdbc:myDataSource"/>
<log message="GENERATED: ${body}"/>
</route>
</camelContext>
<!-- MySQL datasource -->
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="myDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test"/>
<property name="username" value="root"/>
<!-- <property name="password" value="XXXXX"/> -->
</bean>
The MySQL database setup is very simple and you can use any sample database tables you want. Just make sure you update the Apache Camel route and your environment settings accordingly.
Code will be available soon...
UDPATE:
Sample code is now available at: https://github.com/mjabali/DBOverWS
Tuesday, April 10, 2012
It's not lack of content...
We all have that excuse of no time for blogging or lack of interesting content for not updating our tech-y blogs but in fact there are tons of interesting things that I'm working on right now like a JDBC over WebSocket project which seems to be a really nice thing to do and also an end-to-end prototype that we at Kaazing put together for an airline company.
Basically, the airline use case goes from backend JMS-based systems to mobile devices over WebSocket using Kaazing WebSocket Gateway JMS Edition notifying the users about gate changes and flight cancellations. You gotta see this in action! It's super cool... Since it has some proprietary systems I won't be able to show you all parts but I've been working on a generic version of it where you can install all the pieces in your machine and run the whole thing locally. Ping me if you want to take a look on that.
The other project that I'm working on is the JDBC over WebSocket which basically uses Kaazing WebSocket Gateway HTML5 Edition to connect to an Apache Camel route with a Mina component and JDBC access to a MySQL database. Everything is pretty straightforward and I'll be writing a tutorial on that in the near future. But, if you need any additional info or sample code just let me know and I'll walk you thru whatever is needed to get you going...
Stay tuned!
Basically, the airline use case goes from backend JMS-based systems to mobile devices over WebSocket using Kaazing WebSocket Gateway JMS Edition notifying the users about gate changes and flight cancellations. You gotta see this in action! It's super cool... Since it has some proprietary systems I won't be able to show you all parts but I've been working on a generic version of it where you can install all the pieces in your machine and run the whole thing locally. Ping me if you want to take a look on that.
The other project that I'm working on is the JDBC over WebSocket which basically uses Kaazing WebSocket Gateway HTML5 Edition to connect to an Apache Camel route with a Mina component and JDBC access to a MySQL database. Everything is pretty straightforward and I'll be writing a tutorial on that in the near future. But, if you need any additional info or sample code just let me know and I'll walk you thru whatever is needed to get you going...
Stay tuned!
Thursday, March 8, 2012
How to Setup RabbitMQ Message Broker with Kaazing WebSocket Gateway - AMQP Edition
If you want to try the Kaazing WebSocket Gateway - AMQP Edition with RabbitMQ, take a look on the following steps...
If you are trying this setup on a Mac, make sure you have Erlang already installed otherwise have a look on my previous post on How to Install Erlang on Mac OS X Snow Leopard.
Install RabbitMQ
- Download RabbitMQ from http://www.rabbitmq.com/download.html
- Extract the file to the desired directory
- Navigate to RabbitMQ installation directory and run the following command:
$ sbin/rabbitmq-server
If RabbitMQ is started correctly you should see a message similar to the following:
Install and Run Kaazing WebSocket Gateway - AMQP Edition
- Download and install Kaazing WebSocket Gateway - AMQP Edition
- Navigate to the Kaazing WebSocket Gateway installation directory and start it using the following command:
$ bin/gateway.start
Open your web browser of choice and navigate to http://localhost:8001 then select DEMOS on top menu.
At this point, you should be able to run any of the demos available using RabbitMQ as the backend messaging system.
If you are trying this setup on a Mac, make sure you have Erlang already installed otherwise have a look on my previous post on How to Install Erlang on Mac OS X Snow Leopard.
Install RabbitMQ
- Download RabbitMQ from http://www.rabbitmq.com/download.html
- Extract the file to the desired directory
- Navigate to RabbitMQ installation directory and run the following command:
$ sbin/rabbitmq-server
If RabbitMQ is started correctly you should see a message similar to the following:
Activating RabbitMQ plugins ...
********************************************************************************
********************************************************************************
0 plugins activated:
+---+ +---+
| | | |
| | | |
| | | |
| +---+ +-------+
| |
| RabbitMQ +---+ |
| | | |
| v2.7.1 +---+ |
| |
+-------------------+
AMQP 0-9-1 / 0-9 / 0-8
Copyright (C) 2007-2011 VMware, Inc.
Licensed under the MPL. See http://www.rabbitmq.com/
node : rabbit@yoda
app descriptor : /Applications/Kaazing/kaazing-websocket-gateway-amqp-3.2.0/rabbitmq_server-2.7.1/sbin/../ebin/rabbit.app
home dir : /Users/Marcelo
config file(s) : (none)
cookie hash : AYkkciNJ6lsr2dyADBN8ww==
log : /Applications/Kaazing/kaazing-websocket-gateway-amqp-3.2.0/rabbitmq_server-2.7.1/work/rabbitmq/rabbit@yoda.log
sasl log : /Applications/Kaazing/kaazing-websocket-gateway-amqp-3.2.0/rabbitmq_server-2.7.1/work/rabbitmq/rabbit@yoda-sasl.log
database dir : /Applications/Kaazing/kaazing-websocket-gateway-amqp-3.2.0/rabbitmq_server-2.7.1/work/rabbitmq/mnesia/rabbit@yoda
erlang version : 5.9
-- rabbit boot start
starting file handle cache server ...done
starting worker pool ...done
starting database ...done
starting codec correctness check ...done
-- external infrastructure ready
starting plugin registry ...done
starting auth mechanism cr-demo ...done
starting auth mechanism amqplain ...done
starting auth mechanism plain ...done
starting statistics event manage ...done
starting logging server ...done
starting exchange type direct ...done
starting exchange type fanout ...done
starting exchange type headers ...done
starting exchange type topic ...done
-- kernel ready
starting alarm handler ...done
starting node monitor ...done
starting cluster delegate ...done
starting guid generator ...done
starting memory monitor ...done
-- core initialized
starting empty DB check ...done
starting exchange, queue and binding recovery ...done
starting mirror queue slave sup ...done
starting adding mirrors to queues ...done
-- message delivery logic ready
starting error log relay ...done
starting networking ...done
starting direct_client ...done
starting notify cluster nodes ...done
broker running
Install and Run Kaazing WebSocket Gateway - AMQP Edition
- Download and install Kaazing WebSocket Gateway - AMQP Edition
- Navigate to the Kaazing WebSocket Gateway installation directory and start it using the following command:
$ bin/gateway.start
Open your web browser of choice and navigate to http://localhost:8001 then select DEMOS on top menu.
At this point, you should be able to run any of the demos available using RabbitMQ as the backend messaging system.
Monday, March 5, 2012
Installing Erlang on Mac OS X Snow Leopard
I'm working with a customer who is using the Kaazing WebSocket Gateway - AMQP Edition with RabbitMQ and while his install was pretty straightforward on Windows 7 I thought the same would be applicable to my case (a Mac user). Well, to summarize the process, it was quite of a challenge to get everything working, not from the complexity perspective but for the number of steps involved in the process to get the environment running starting from the point that RabbitMQ depends on Erlang to run. So, that was the first step... Installing Erlang on Mac OS X
Here are the steps I had to take:
- Download and install Apple Xcode 4.3 from Apple's AppStore (yeah, you read it right!)
- The tricky part here was to enable Command Line Tools which is not selected by default in Xcode. To do that, go to Xcode Preferences --> Downloads --> Components and install Command Line Tools. It's just another 170MB over the already downloaded 1.35GB of Xcode :)
- Download Erlang latest release from http://www.erlang.org/download.html
- Extract the Erlang package (i.e. tar -xvf otp_src_R15B.tar) and navigate into the recently created directory
- Run ./configure
- Run ./make
- Run sudo make install
Hope this help you to get your project going...
Here are the steps I had to take:
- Download and install Apple Xcode 4.3 from Apple's AppStore (yeah, you read it right!)
- The tricky part here was to enable Command Line Tools which is not selected by default in Xcode. To do that, go to Xcode Preferences --> Downloads --> Components and install Command Line Tools. It's just another 170MB over the already downloaded 1.35GB of Xcode :)
- Download Erlang latest release from http://www.erlang.org/download.html
- Extract the Erlang package (i.e. tar -xvf otp_src_R15B.tar) and navigate into the recently created directory
- Run ./configure
- Run ./make
- Run sudo make install
Hope this help you to get your project going...
Monday, February 27, 2012
Quick Start with the Kaazing WebSocket Gateway in Less Than 6 Minutes
One of my colleagues at Kaazing just recorded a very nice tutorial on how to get started with the Kaazing WebSocket Gateway using the extreme powerful JMS Edition.
It only takes a few minutes to download, install, start up, and try out the Kaazing WebSocket Gateway. So, it's really worth it...
You can take a peek here: http://vimeo.com/36919680
Enjoy...
Moving On...
Well, it has been a while since I updated this blog and there are many reasons just to say that I wasn't motivated enough to write anything lately. Some personal issues as well as another job change associated with a short vacation contributed to the delay but the good part is that I'm back and really happy with how the year is shaping up.
It seems to be that all personal stuff is sorted out and I also have decided to join Kaazing as a Solutions Architect. Kaazing is the first Enterprise-grade Web Communications Platform leveraging HTML5 WebSockets designed for real-time, massive scalability and providing reliability necessary for companies to deploy those kind of solutions over the web.
If you're not familiar with HTML5 and WebSockets and I'd recommend you to take a look on the following presentation available at http://www.infoq.com/presentations/WebSockets-The-Web-Communication-Revolution.
Stay tuned for more...
It seems to be that all personal stuff is sorted out and I also have decided to join Kaazing as a Solutions Architect. Kaazing is the first Enterprise-grade Web Communications Platform leveraging HTML5 WebSockets designed for real-time, massive scalability and providing reliability necessary for companies to deploy those kind of solutions over the web.
If you're not familiar with HTML5 and WebSockets and I'd recommend you to take a look on the following presentation available at http://www.infoq.com/presentations/WebSockets-The-Web-Communication-Revolution.
Stay tuned for more...
Subscribe to:
Posts (Atom)
Setting Up Local Environment for Developing Oracle Intelligent Bots Custom Components
Oh the joy of having a local development environment is priceless. For most cloud based solutions the story repeats itself being hard to tr...

-
Web Services are very important components of most (if not all) of the integration projects these days. The Web Services architecture make t...
-
A few days ago I was helping an Apache user getting the ActiveMQ Web Console up and running on ServiceMix 4.4. At first instance, it seems ...
-
On my previous post ( Preserving Message Order with Apache ActiveMQ ) we took a look on what would be necessary to preserve message order u...