spring-cloud / spring-cloud/spring-cloud-gateway

Spring Cloud Gateway Fanout With multiple websocket services

Open
#3,755 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.