☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Failed to connect to Bokeh server: Could not open websocket error

Community Supportbrowserserverbokeh
Bryan
Bryan

If the websocket connection fails, that means something in between the user and the Bokeh server blocked it. That could be a proxy (e.g. nginx) or firewall or something else. There is not nearly enough information here to begin to speculate beyond that. You’ll need to describe your network setup and configuration in some detail. Otherwise, all I can do is point to the documentation which provides configuration guidance for some common cases.

⌁   Link to post
Bryan
Bryan

Unfortunately, no. There are lots of possibilities and I’m only actually passingly familiar with a handful. If you describe what comprises your end to end setup I might have pointers, but no guarantee. Generally speaking: you need to look at everything that runs in-between your Bokeh server and the user’s browser, and investigate whether it requires some explicit configuration to enable websocket connections (e.g. by web or docs searching, and looking in logs for relevant warnings or errors). For example, of the top of my head: nginx, AWS load balancers, and Apache proxies all require some configuration to handle websockets.

⌁   Link to post
malavika-tii
malavika-tii

I tried all different combinations.
These are the commands I used to run the script.

  1. sudo nohup ./serve.py --show --allow-websocket-origin=hostname:5006
  2. bokeh serve --show --allow-websocket-origin=‘*’ serve.py&
  3. bokeh serve --show --allow-websocket-origin=‘*’&
    All of them return the same error. “[bokeh] Failed to load Bokeh session R4l7idJAv0GVKVWsIJ79977ofmamtBRlnL74LjVcDtBs: Error: Could not open websocket”

Could you please let me know other possibilities which could be checked?

⌁   Link to post
Bryan
Bryan

If you have set --allow-websocket-origin=‘*’ then Bokeh itself will not reject any websocket connections. You should be able to look at the Bokeh server logs and confirm there are no messages about rejected connections. My expectation is that the websocket connection is not even reaching the Bokeh server at all, i.e. the problem is upstream “in front” of the Bokeh server. You’re going to have to look at every log you can find for clues, I can’t help with specifics of that because I know literally nothing about your end to end setup.

⌁   Link to post
Bryan
Bryan

Bokeh just outputs it’s log to console by default. If you are running the Bokeh server on some cloud platform or something, you’ll have to ask their support people where they save “stdout” process logs off to. That’s not a Bokeh question.

⌁   Link to post
malavika-tii
malavika-tii

Hi Bryan,

ssrc-malavika@t01pjfssrc01:~/flight_review_tool/app$ sudo python3 serve.py --port=5006 --address=0.0.0.0 --allow-websocket-origin=‘’ --use-xheaders
WARNING:bokeh.server.util:Host wildcard '
’ will allow connections originating from multiple (or possibly all) hostnames or IPs. Use non-wildcard values to restrict access explicitly

It is stuck here. I dont see any logs.

⌁   Link to post
Bryan
Bryan

I just noticed you are not running bokeh serve ? What is serve.py ? My answer only refers to running the Bokeh server directly with bokeh serve I have no idea what serve.py is or does. If you are using the Bokeh server API programmatically you’ll need to set up the Python logger yourself (that’s one of the things bokeh serve does for you).

Again you have provided no information about: what exactly you are running (code? What is serve.py?) How the app is being used (Are users hitting the app directly? Are you trying to embed the app in another page?), where you are running it (locally? on AWS or GCP or Azure? Some other cloud host?) Where are users connecting from and what the network infrastructure is like (are there proxies involved? load balancers? firewalls?)

⌁   Link to post
malavika-tii
malavika-tii

ssrc-malavika@t01pjfssrc01:~/flight_review_tool/app$ bokeh serve --show --allow-websocket-origin=‘’&
[1] 2405901
ssrc-malavika@t01pjfssrc01:~/flight_review_tool/app$ 2024-09-20 16:34:11,904 Starting Bokeh server version 3.1.0 (running on Tornado 6.4.1)
2024-09-20 16:34:12,110 Host wildcard '‘
’’ will allow connections originating from multiple (or possibly all) hostnames or IPs. Use non-wildcard values to restrict access explicitly
2024-09-20 16:34:12,110 User authentication hooks NOT provided (default user enabled)
2024-09-20 16:34:12,113 Bokeh app running at: http://localhost:5006/
2024-09-20 16:34:12,113 Starting Bokeh server with process id: 2405901

With bokeh serve too, it is the same output

⌁   Link to post
Bryan
Bryan

With bokeh serve too, it is the same output

That is the standard starting log. As I already stated, at this point the server is waiting for connections and there will be no other output until a connection request comes in (i.e. when a browser tries to load the app page). There are two options:

  • A browser tries to connect, and the log updates with more output ==> post that ouput here

  • A browser tries to connect, and the log does not update with more output ==> something else is blocking the connection, and this is not a Bokeh issue

⌁   Link to post
malavika-tii
malavika-tii

Hi Bryan,

The browser tried to connect but I couldnt see the output. So, is it that something else is blocking the connection ? How do we find this ? The port is open and there is no firewall that is blocking the connection.

⌁   Link to post
Bryan
Bryan

This isn’t something I can help with because I simply have no information about your network infrastructure at all to go on, or even what kind of environment you are trying to run things on, and subsequently access things from. If you have network administrators for your business or university or wherever it is that you are running things, you will need to engage them for assistance. If you are running on a cloud provider, you will need to check with their docs or support.

And, I want to access it on another domain name, but it is hosted on localhost… How do i change it

You can run the Bokeh server on a server on that network, or you can run a proxy like nginx on the desired network that forwards to the Bokeh server on a different network, or you can serve a page on the desired network that embeds the Bokeh server content from a different network…

I’m not sure how else to convey this: it’s not possible to offer specific guidance without actual details of your situation, and what precisely it is you want to accomplish.

⌁   Link to post
Bryan
Bryan

We are clearly not communicating effectively, and you do not seem able to provide any information about the details of your situation. I am not able to assist further, but I wish you the best of luck. I would still recommend reaching out to the actual project with your issues.

⌁   Link to post

End of archived discussion · Replies are disabled