Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add websockets support #240

Merged
merged 1 commit into from
Nov 7, 2017
Merged

Add websockets support #240

merged 1 commit into from
Nov 7, 2017

Conversation

tribal-tec
Copy link
Contributor

  • All PUT messages are supported using a JSON text message with an "event"
    and "data" field where "event" corresponds to the REST endpoint and
    "data" as specified by endpoint/schema. For the camera, it looks like this:
    {
    "event" : "v1/camera",
    "data" : {
    "look_at" : [ 1.0 0.5 0.5 ]
    }
    }
  • So far only the camera gets broadcasted as a JSON text message when it
    was modified. The JSON format is the same as for PUT, but contains all camera
    values.

* All PUT messages are supported using a JSON text message with an "event"
  and "data" field where "event" corresponds to the REST endpoint and
  "data" as specified by endpoint/schema. For the camera, it looks like this:
  {
     "event" : "v1/camera",
     "data" : {
       "look_at" : [ 1.0 0.5 0.5 ]
     }
  }
* So far only the camera gets broadcasted as a JSON text message when it
  was modified. The JSON format is the same as for PUT, but contains all camera
  values.
@rolandjitsu
Copy link
Contributor

@tribal-tec so we have but one shared socket for all events?

Copy link

@rdumusc rdumusc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, nice and simple way to get started!
I was working in a branch in Rockets on moving the json-rpc parser from tide and adding asynchronous request processing, error codes, etc.. but it's likely not needed at this point. Interestingly I also ended up using this nlohmann::json :-)

@tribal-tec tribal-tec merged commit 0f6ffd7 into BlueBrain:rockets Nov 7, 2017
@rolandjitsu
Copy link
Contributor

rolandjitsu commented Nov 9, 2017

I think there might be an issue with the {data}. By the looks of it, there seems to be double JSON serialization, on the main socket message and the {data} property:

{
    "data": "{\n   \"aperture\" : 0.0,\n   \"eye_separation\" : 0.063500002026557922,\n   \"field_of_view\" : 45.0,\n   \"focal_length\" : 0.0,\n   \"look_at\" : [ 0.73252975940704346, 1.1178562641143799, 1.0505576133728027 ],\n   \"origin\" : [ 2.442774772644043, 4.600367546081543, 7.2228507995605469 ],\n   \"stereo_mode\" : \"none\",\n   \"up\" : [ -0.45402175188064575, -0.82591044902801514, -0.33421853184700012 ]\n}\n",
    "event": "camera"
}

@tribal-tec

@tribal-tec
Copy link
Contributor Author

True, good catch. Will provide a fix

tribal-tec added a commit to tribal-tec/Brayns that referenced this pull request Nov 10, 2017
tribal-tec added a commit that referenced this pull request Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants