Perplexica
Perplexica copied to clipboard
WebSocket Connection Failure in DevTools Console
Title: WebSocket Connection Failure in DevTools Console
Body:
Issue Description
When attempting to establish a WebSocket connection, the DevTools console displays the following error message:
page-c1977eaac74b29da.js:1 WebSocket connection to 'ws://127.0.0.1:3001/' failed:
Steps to Reproduce
- Open the DevTools console in the browser.
- Attempt to connect to the WebSocket server at
ws://127.0.0.1:3001/
. - Observe the error message.
Expected Behavior
The WebSocket connection should be established successfully without any errors.
Actual Behavior
The connection fails, and the DevTools console logs an error message indicating the failure.
Possible Solutions
- Check if the WebSocket server is running and listening on the correct port.
- Ensure there are no network issues or firewalls blocking the connection.
- Verify the WebSocket server configuration for any potential issues.
Additional Context
Please provide any additional information that might be helpful in resolving this issue, such as server logs, network configuration, or browser version.
Hi, I understand the problem and I would recommend you to follow the solutions you shared. Make sure the API server is accessible from the browser at http://127.0.0.1:3001. If not please check the configuration, firewall errors or network issues
@ItzCrazyKns It seems that the WebSocket server is not defined in any provided Dockerfiles or the docker-compose.yaml file. So then how do I start or initiate and handle the WebSocket server here? Due to this, Am I getting the different console errors like page-2abbb79b5568719c.js:1 WebSocket is already in CLOSING or CLOSED state
? Help fix these WebSocket problems.
Also, how do I make sure the API server is accessible from the browser at http://127.0.0.1:3001/?
Hi, I understand the problem and I would recommend you to follow the solutions you shared. Make sure the API server is accessible from the browser at http://127.0.0.1:3001. If not please check the configuration, firewall errors or network issues @ItzCrazyKns
Also, how do I make sure the API server is accessible from the browser at http://127.0.0.1:3001/?
@ItzCrazyKns From VM_Ubuntu_Bash **:~/Perplexica$ docker compose logs**
of perplexica-backend
...
perplexica-perplexica-backend-1 | yarn run v1.22.19
perplexica-perplexica-backend-1 | $ node dist/app.js
perplexica-perplexica-backend-1 | WebSocket server started on port 3001
perplexica-perplexica-frontend-1 | ✓ Ready in 951ms
perplexica-perplexica-backend-1 | (node:28) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
...
perplexica-perplexica-backend-1 | (Use `node --trace-deprecation ...` to show where the warning was created)
perplexica-perplexica-backend-1 | API server started on port 3001
perplexica-perplexica-backend-1 | Connection closed
perplexica-perplexica-backend-1 | Connection closed
perplexica-perplexica-backend-1 | Connection closed
perplexica-perplexica-backend-1 | Connection closed
perplexica-perplexica-backend-1 | Connection closed
...
Also, how do I make sure the API server is accessible from the browser at http://127.0.0.1:3001/?
Hi, I understand the problem and I would recommend you to follow the solutions you shared. Make sure the API server is accessible from the browser at http://127.0.0.1:3001. If not please check the configuration, firewall errors or network issues @ItzCrazyKns
Also, how do I make sure the API server is accessible from the browser at http://127.0.0.1:3001/?
Just visit this URL http://127.0.0.1:3001/api and see if something appears there.
@ItzCrazyKns It seems that the WebSocket server is not defined in any provided Dockerfiles or the docker-compose.yaml file. So then how do I start or initiate and handle the WebSocket server here? Due to this, Am I getting the different console errors like
page-2abbb79b5568719c.js:1 WebSocket is already in CLOSING or CLOSED state
? Help fix these WebSocket problems.
The WebSocket part is handled by the server. It is defined at src/websocket/index.ts
Also if you're making use of Ollama, make sure to use the complete model name in the config.toml
file (like llama2:latest
), or you can download the latest version of Perplexica, it has a settings page from where you can edit it without having to configure the config file manually.
@ItzCrazyKns In the config.toml case, there are still errors particularly related to Perplexica Backend docker container : WebSocket/API servers
Error loading Ollama models: TypeError: Fetch Failed Connection Closed
despite the API and Ollama seems ok as follows.
http://127.0.0.1:3001/api
{
"status": "ok"
}
...
localhost:11434
Ollama is running
In the .env case, it turns out that it becomes like WebSocket Failed at some point after within a few minutes of starting the docker containers but no answer generation at all anytime. Error Connection Refused. Help fix these major WebSocket issues everywhere particularly Ollama and also non-ollama case.
Change your Ollama URL to http://host.docker.internal:11434
, Ollama should work fine then.
Change your Ollama URL to
http://host.docker.internal:11434
, Ollama should work fine then.
doesn't work for me
Change your Ollama URL to
http://host.docker.internal:11434
, Ollama should work fine then.doesn't work for me
Could you please provide more information?
I'm trying to run this on a MacBook, using openai as the provider.
I keep getting connection closed
in the logs with no other error message.
When entering a search the ui changes to the search result page, but nothing else happens.
No messages in the logs and I can't find anywhere were there is a record of a request being sent to the backend
I'm trying to run this on a MacBook, using openai as the provider.
I keep getting
connection closed
in the logs with no other error message. When entering a search the ui changes to the search result page, but nothing else happens.No messages in the logs and I can't find anywhere were there is a record of a request being sent to the backend
My issue was due to having another service using port 8080 so the SEARXNG server could not bind to the port.
We need more logging messages to make it easer to debug though @ItzCrazyKns
same problem
my config
docker compose
api
Could you show the backend logs? If it says something like connected failed while fetching Ollama models its probably because it could not connect to Ollama. I am working on a patch that would fix it.
Hi @arunkumarakvr is this issue resolved or your still need support? If you don't respond within the next 24 hours we'll close this issue as completed.
@ItzCrazyKns Could you please show or share with us how you've resolved or fixed this issue particularly? Anything else is done to fix this WebSocket issue particularly, as I still don't know how to fix this issue or what caused this in the first place. And it also seems that many still have been experiencing this unresolved WebSocket issue. I think you should take some action for resolving this to fix it. Best.