Bokeh script tag from server_document does not work

I am trying the example code for embedding a bokeh server app in html using the server_document() function.

I am getting a websocket connection error

WebSocket connection to 'ws://' failed:

The html code is:


any ideas?

Generally speaking, anyone who deploys a Bokeh server app will want to exert control over who and where the app can be emedded, and not e.g. allow anyone in the world to directly embed their app without their permission. The demo site is not configured to allow connections like this, except from requests that have as their ORIGIN (which will not be the case for where ever your page is hosted).

You will need to try things out with a Bokeh server that you run yourself, with --allow-websocket-origin or BOKEH_ALLOW_WS_ORIGIN configured to allow connections from your embedding origin (or "*" to open things up to any origin).

Thank you! I tried my own server app with --allow-websocket-origin and I was able to successfully embed the app in an html file.

1 Like