Service Virtualization

Expand all | Collapse all

DT Support for WebSockets API

  • 1.  DT Support for WebSockets API

    Posted May 10, 2016 03:00 PM

    The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API in Web IDL is being standardized by the W3C.

     

    One of our dev teams has selected WebSockets as the protocol hanlder for one of our applications. it is an event driven messaging model, which supports non-sequential message handling.

     

    send msg1

    send msg2

    send msg3

    receive msg2

    receive msg1

    receive msg3

     

    how can I make a simulator that supports that mechanism?  the data protocol is JSON, so that is easy.

     

    the standard model will work for the data protocol part (json) and the wire protocol part (sockets). but the out of order responses is the part we need to add on

     

    websockets is a 5 year old standard.



  • 2.  Re: DT Support for WebSockets API

    Posted May 11, 2016 02:20 PM

    nobody?   I hate being on the bleeding edge...!



  • 3.  Re: DT Support for WebSockets API

    Posted May 12, 2016 10:16 AM

    so, is there a mechanism to capture (serialize) the transaction state?  and deserialize  it later.?

     

    I 'think' a solution to this websockets protocol is to separate the thing into two components..

     

    part 1 - (loop 1) listen, serialize to object, put object on queue. , back to listen

    part 2 - (loop 2) randomly pic entry from queue, deserilize, and resume transaction logic. vsi/vsm...

     

    one thing I didn't notice, is that the client 'connects' (session) to the server, (both ends now have a persistent connection object),

    THEN sends messages or receives message events.. (which might be responses, OR unsolicited  data

    over a long period of time..

     

    example of server, and message communication process

    Writing a WebSocket server in Java - Web APIs | MDN

    so I don't know if the current DT msg event isolation will work at all.



  • 4.  Re: DT Support for WebSockets API

    Posted May 12, 2016 12:14 PM

    the more I look at this, the more it seems I need to put the WebSocket Server in front of DT. it would become the client, message sender, and DT would see http type messages.  and respond in serial fashion.



  • 5.  Re: DT Support for WebSockets API
    Best Answer

    Posted May 13, 2016 03:57 PM

    so, I have built this implementation..

     

    some client (app, chrome with WS plugin, soapui with WS plugin, readyapi (already has ws plugin), standalone client, ...

           client connects to websockets server, one time, all comm over this applicaiton level connection

     

           ---->  connect & sends to my custom websockets server

                     ---->  sends to DevTest as a Rest api request.(post with body)

                              DT processes like normal

                      <----  send response (to webSockets server)

            <---   server sends response to client

     

    repeat..send/receive at client, as needed

     

    now the only bad part, is that the https headers that might be included in the ws://server:port call are not surfaced in the websocket server (that I can find so far).

    same for on the way back..

     

    now.. can I do this with DT test?  my 'guess' is a websocket client libs can be called to handle all that (script steps)..  yet to try.



  • 6.  Re: DT Support for WebSockets API

    Posted May 16, 2016 02:55 PM

    So, if I want to make my own test steps.. I need 4..

     

    open connection

    send

    receive

    close connection

     

    I see the sdk info on custom java test step

     

    it 'looks like' I have to create a unique class per step.. right?



  • 7.  Re: DT Support for WebSockets API

    Posted May 18, 2016 12:27 PM

    I demoed this solution to the test team yesterday and they are excited to get started. I deployed a customized amazon ami today with all this on board.

    all they have to do is upload a control file and spreadsheet for their application transaction messages..(my version of data driven service)

    the webSocket to DT interface uses the uri path on the webSocket Open as the uri into DT.. so they can have as many uri options as needed.



  • 8.  Re: DT Support for WebSockets API

    Posted May 16, 2016 10:17 AM

    Can anyone help Sam work through this issue? Looks like he's almost got it figured out!



  • 9.  Re: DT Support for WebSockets API

    Broadcom Employee
    Posted May 16, 2016 11:10 AM

    Sam has got further than I did. When I wasn't having much luck, I voted for the WebSocket support idea at Websocket Protocol



  • 10.  Re: DT Support for WebSockets API

    Posted May 16, 2016 12:42 PM

    thanks.. I will have to add a task for myself to look thru the ideas.. I forget to do that all the time..



  • 11.  Re: DT Support for WebSockets API

    Posted May 18, 2016 12:28 PM

    in another topic I created custom test steps to implement the client side of this so that we can use DT test to drive the simulator (and later the real product)