WebSocket Responce Error

Hi Team,


Using Java websocket to connect to WebSocket API, the request is {"ID":2,"Key":{"Name":"SHICNY3MD="}},the error is "Request Rejected:Request Key did not contain service Id".

How to fix this?


Thanks

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    Hello @dreamjie2020

    I am assuming that you are connecting to your local RTDS server.

    This "Request Rejected:Request Key did not contain service Id" error message means your local RTDS server does not configure a default service id in the RTDS configuration. The WebSocket applications must specify a service in the item requests like the following:

    {
      "ID":2,
      "Key":{
        "Name":"<RIC Name>",
        "Service":"<Service Name>"
      }
    }

    Example:

    {
      "ID":2,
      "Key":{
        "Name":"JPY=",
        "Service":"ELEKTRON_DD"
      }
    }

    Please contact your local Market Data team about your RTDS service name.

    ### RTDS Default Service ID ###

    The default WebSocket request service id can be set via the following RTDS configuration

    *ads*defaultJsonServiceId: <Service ID>

    This RTDS configuration defines the default service for the WebSocket client applications. The service can be overridden in the JSON request message.

    If defaultJsonServiceId is empty, there is no default service id. The WebSocket applications must always specify a service in the item requests.

    Please contact your local Market Data team if you need this RTDS parameter to be configured.

Answers

  • Hi @dreamjie2020,

    For an application built using Java, another option is to use the EMA SDK. The SDK is easy to use and automates all the tasks of connecting, maintaining a session, automatic recovery and re-subscription in case of disconnect etc. This free's up a lot of application's tasks like maintaining periodic handshake messages with the server.

    EMA can use both Websockets as a transport and also binary RSSL protocol and can seamlessly get data from hosted RTMDS, as well as RTO cloud.

    See this Quickstart guide for EMA, if you are interested.