Skip to content

Modify web socket response formats #67

@klucar

Description

@klucar

I found a good convention for JSON messages over web sockets, and suggest we switch to it. Basically we would always reply with a JSON array, the first element of the array is the operation and the second entry is the JSON data.

Current format:

{
  "operation" : "suggest",
  "sessionId" : "<value of TSESSIONID>",
  "type" : "metrics",
  "q" : "sys.cpu",
  "max" : 30
}

Suggested Format:

[  "suggest",
{
  "sessionId" : "<value of TSESSIONID>",
  "type" : "metrics",
  "q" : "sys.cpu",
  "max" : 30
}
]

Reference:
https://www.new-bamboo.co.uk/blog/2010/02/10/json-event-based-convention-websockets/

An alternative to investigate is the WAMP setup:
http://wamp-proto.org
Which has a Java Jetty implementation at:
http://www.connectanum.com/index.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions