0

Please bear with me, I am a bit new to these terminologies. Sorry in advance for my misunderstanding. What I am seeking may not even be possible.

Seeking Solution For:

I would like to find a solution which allows bidirectional communication between the server(weblogic) <--> client same session (http, websocket). This communication should be considered 'Same Session'. This will be geared towards mobile applications (iOS, Android, Windows) to enable the native application communication to the web server over the same session as the Webview Facade.

              |Webview -> http
server  <-->  |               Both connection are considered the same user.
              |Native -> ws

Current Implementation:

We are currently queuing JavaScript message objects in the global JavaScript context for the mobile webview and constantly polling this message queue for new updated messages from the native application. This implementation works somewhat/sometimes but is not the best solution and is a nightmare to maintain. I am seeking an alternative solution which would allow a cleaner approach.

Example flow:

  1. Mobile Webview connects to web application via url: https://webapp/login
  2. User logs into application.
  3. Mobile Webview redirects to dashboard url: https://webapp/dashboard
  4. Native application makes a connection to the websocket via url: wss://webapp/dashboard/ws
  5. Both connections are considered to be the same user and session with the ability to update UI layer via a websocket request.

Is this design/architecture possible? Can Web sockets be used in this manner? Can Web sockets share the same HTTP session?

Any help/pointers or just general knowledge in this realm would be greatly appreciated . Thanks

xMythicx
  • 827
  • 1
  • 11
  • 27
  • So what's the question? – eleven Sep 01 '15 at 14:47
  • Fox in socks sorry for the unclear question. I have updated the question. – xMythicx Sep 01 '15 at 15:05
  • What you are describing is not possible, unless you create your own WebView implementation. It's possible to connect to web sockets in Android (not sure if the standard libraries support it, but you can always make your own implementation or use a lib, it's an open standard) but to share it with the WebView you need to modify the WebView code to make that possible, I imagine that would not be an easy task. – JohanShogun Sep 01 '15 at 21:37
  • Hi JohanShogun, thanks for your response. My intention is not to serve websockets from the device if that is the direction your above statement was headed. Also I have no interest in the Webview facade connecting to a websocket from the webpage. My intention is to connect to the websocket from native code using a library such as https://github.com/square/SocketRocket. My Challenge is JEE user session. The websocket connection and the http session should be seen as the same from the context of the server. – xMythicx Sep 01 '15 at 21:45
  • I have found a pretty decent post here http://stackoverflow.com/questions/17936440/accessing-httpsession-from-httpservletrequest-in-a-web-socket-serverendpoint currently working through it. Still not sure if it will work for my use case. – xMythicx Sep 01 '15 at 21:46

0 Answers0