question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connect using websocket ?

See original GitHub issue

Hello, i want ask a question. I’m enabling websocket connection on nats-server config, can this library connect using websocket protocol instead standard protocol ? i’m already tried change server url from localhost:4222 into ws://localhost:${PORT} but got nothing response.

My Environtment: node: 14.17.5 natsjs: ^2.2.0 nats-server: docker alpine:latest

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
aricartcommented, Sep 19, 2021
0reactions
aricartcommented, Sep 19, 2021

correct - if you installed as npm install nats.ws, then your import will be:

import { connect, StringCodec } from "./node_modules/nats.ws/nats.js";

If you are using node, as I was, the import was from the ./node_modules/nats.ws/nats.cjs

Read more comments on GitHub >

github_iconTop Results From Across the Web

The WebSocket API (WebSockets) - Web APIs - MDN Web Docs
desktop desktop Chrome Edge WebSocket Full support. Chrome4. Toggle history Full support. Edge12. Toggl... WebSocket() constructor Full support. Chrome4. Toggle history Full support. Edge12. Toggl...
Read more >
WebSocket
To open a websocket connection, we need to create new WebSocket using the special protocol ws in the url: let socket = new...
Read more >
Using WebSocket requests
In Postman you can create a WebSocket request with a server, and use it to send and receive messages across the WebSocket connection....
Read more >
Using WebSocket to build an interactive web application
The connect() function uses SockJS and stomp.js to open a connection to /gs-guide-websocket , which is where our SockJS server waits for connections....
Read more >
WebSockets - Opening Connections
WebSockets - Opening Connections, Once a connection has been established between the client and the server, the open event is fired from Web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found