Skip to content

Conversation

@gedemagt
Copy link

@gedemagt gedemagt commented Nov 21, 2025

Summary

This PR adds websockets to async-nats.

Vector configuration

sources:
  nats-input:
    type: nats
    subject: input
    url: ws://localhost:8080
    connection_name: test

sinks:
  nats:
    type: nats
    inputs:
      - nats-input
    subject: test
    url: ws://localhost:8080
    encoding:
      codec: json

How did you test this PR?

Running a nats server with the following docker-compose.yml

configs:
  nats-server.conf:
    content: |
      server_name: sitehub
      websocket {
          port: 8080
          no_tls: true
      }

services:
  nats:
    image: nats:2.11.8
    ports:
      - "8080:8080"
      - "4222:4222"
    configs:
      - nats-server.conf
    command:
      - "--config=/nats-server.conf"

The Vector config specified in the previous section was used, and then the data feed through was tested with a few nats commands:

nats sub test

nats pub input Hello

This results in the following on the subscription

20:25:04 Subscribing on test
[#1] Received on "test"
{"message":"Hello","source_type":"nats","subject":"input","timestamp":"2025-11-21T19:25:33.011930438Z"}

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details here.

@github-actions
Copy link

github-actions bot commented Nov 21, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@gedemagt gedemagt changed the title Added feature flag for websockets in async-nats feat(nats): Added feature flag for websockets in async-nats Nov 21, 2025
@gedemagt
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@gedemagt gedemagt marked this pull request as ready for review November 21, 2025 19:31
@gedemagt gedemagt requested a review from a team as a code owner November 21, 2025 19:31
@thomasqueirozb
Copy link
Contributor

recheck

@gedemagt
Copy link
Author

gedemagt commented Dec 2, 2025

Do I need to do more work on this to get a review?

@thomasqueirozb
Copy link
Contributor

Hi @gedemagt, can you add a changelog? This is a nice addition.

Also, do you know what the behavior was previously? Did it panic/crash, fail with some (useful) error message or silently fail?

@thomasqueirozb thomasqueirozb added the meta: awaiting author Pull requests that are awaiting their author. label Dec 15, 2025
@int3ro
Copy link

int3ro commented Jan 13, 2026

Bump @gedemagt would love to see this PR get merged!

@swelborn
Copy link

Will this also enable support for wss?

@thomasqueirozb thomasqueirozb added sink: nats Anything `nats` sink related source: nats Anything `nats` source related labels Jan 30, 2026
@thomasqueirozb thomasqueirozb self-assigned this Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta: awaiting author Pull requests that are awaiting their author. sink: nats Anything `nats` sink related source: nats Anything `nats` source related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NATS does not support Websocket transport.

4 participants