On May 21, 2017, at 20:41, Florence Wang <[email protected]> wrote:
Hi,
I am trying to connect from JS and C#. And Yes ! "The content and metadata for this message type are empty JSON blocks, but that does not mean they can be omitted. My guess is that omitting them will almost certainly result in protocol corruption of some sort. There are both JS and Python APIs for assembling and sending messages in the right way that are infinitely preferable to use. " was the problem.
I tried to send three exactly same messages (i.e. metadata and content same to the header) to bokeh server and it worked. Sending empty metadata and content json messages also worked.
Thanks a lot
Florence
On Friday, May 19, 2017 at 2:50:15 PM UTC+10, Bryan Van de ven wrote:
Hi,
First, just FYI, I'd be surprised if there are more than three people in the world that have any direct experience with the Bokeh web socket protocol. Also, it's going to be hard to provide any concrete guidance without more information. Are you trying to connect from JS? From Python? From some other language? What are you actually trying to accomplish? Maybe there is a different or better approach entirely.
However, in general, I'd just say that it's probably not a good idea to try and construct the JSON yourself. The protocol messages are multi-part with header, content, and metadata blocks, as well as optional buffers. There are defined APIs maintained under test that coordinate all these pieces correctly. You should probably be using those. As an example:
In [1]: from bokeh.server.protocol import Protocol
In [2]: msg = Protocol("1.0").create("PULL-DOC-REQ")
In [3]: msg.header_json
Out[3]: '{"msgid": "2cd14883-2df8-41ca-9337-426b53c6a2d2", "msgtype": "PULL-DOC-REQ"}'
In [4]: msg.content_json
Out[4]: '{}'
In [5]: msg.metadata_json
Out[5]: '{}'
The content and metadata for this message type are empty JSON blocks, but that does not mean they can be omitted. My guess is that omitting them will almost certainly result in protocol corruption of some sort. There are both JS and Python APIs for assembling and sending messages in the right way that are infinitely preferable to use.
Thanks,
Bryan
> On May 18, 2017, at 20:22, Florence Wang <[email protected]> wrote:
>
>
> Hi,
>
> I am wondering if anyone has experience with the bokeh websocket protocol in retrieving data from web document.
>
> As far as I am concerned, the messages sent to the server should be in JSON format. I don't have problem in setting up the websocket connection through javascript
> and getting the "PATCH-DOC" messages with the data if the data is changing over time.
> But I have been trying to send "PULL-DOC-REQ" messages to the server, but I don't get reply every time I sent the message.
> Here is the message I used to send to the server
> {"msgid":"10000", "msgtype": "PULL-DOC-REQ"}
>
> Anyone have a clue about this ?
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/a5e9836e-388f-46ad-8ac6-4210a4a962c7%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/e802fb78-ec71-4139-be39-49680c8bd215%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.