loopbackio / loopbackio/loopback-next

Could not connect to websocket error when using subscription in graphql example source code

Open
#7,750 1 comment 2 reactions 0 assignees View on GitHub
bug Examples
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

I'm got this error with response when calling subscription in **graphql example** source code. Please check the error description and image bellow.
```
{
"error": "Could not connect to websocket endpoint ws://localhost:3000/subscriptions. Please check if the endpoint url is correct."
}
```
![image](https://user-images.githubusercontent.com/30214934/129315528-adcd4982-b26a-426b-b2ce-f07c80e3262b.png)

STEP TO REPRODUCE.

```
Step 1: Clone the loopback-next source code.
Step 2: Run npm install in the root of source code (not in the example directory)
Step 3: npm start and check the error when calling subscription.
```

System information
```
OS: Windows 10
CPU: AMD Ryzen 5
```

Contributor guide

Open the contributing guide

Research direction

Start by following the issue's reproduction steps in the graphql example and inspect how the subscription WebSocket endpoint is configured. Compare the configured endpoint with ws://localhost:3000/subscriptions and verify the subscription connects successfully; the issue is done when the example no longer reports the connection error.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, nodejs, typescript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.