spring-cloud / spring-cloud/spring-cloud-gateway
Spring Cloud Gateway Fanout With multiple websocket services
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
I have one websocket service that can be connected via ws://localhost:8080/poc/ws1.
I have created Spring coud gateway which is hosted in localhost:7070
When I use below conguration, I could able connect and send message to websocket service via api-gateway(ws://localhost:7070/poc/ws1)
cloud:
gateway:
routes:
- id: ws1-route
uri: ws://localhost:8080
predicates:
- Path=/poc/ws1
Now I have a usecase where I have one more websocket service(ws2 hosted on localhost:8081) and I want to send the same message to this service also.
Limitation from client side is that I can not call api-gateway twice one for ws1 and other for ws2.
I tried to using below gateway routing config:
spring:
application:
name: gateway
cloud:
gateway:
routes:
- id: ws1-route
uri: ws://localhost:8080
predicates:
- Path=/poc/**
filter:
- RewritePath=/poc, /poc/ws1
- id: ws2-route
uri: ws://localhost:8081
predicates:
- Path=/poc/**
filter:
- RewritePath=/poc, /poc/ws2
But it doesn't seems to work. My expectation is when I make call to ws://localhost:7070/poc it should send message to both the ws channel.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository files, tests, or implementation entry points are identified. Start by reviewing Spring Cloud Gateway's WebSocket route handling alongside the supplied ws1 and ws2 route configuration. Done should be a defined and tested way for one gateway WebSocket connection to deliver messages to both services.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100