spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Gateway don't close websocket connection when client close websocket.

Open xurui8691413 opened this issue 6 years ago • 14 comments

Please run application and run GatewayTest can reproduce this problem ,and then run GatewayTest1 can close websocket connection because GatewayTest1 doesn't access through gateway. I think this issue is urgent that blocked us. Looking forward for your reply. spring-cloud-gateway-websocket-master.zip

xurui8691413 avatar Feb 19 '19 01:02 xurui8691413

I also have the same problem and look forward to repairing it as soon as possible.

sfk123 avatar Feb 21 '19 09:02 sfk123

I can confirm. I've also sent how to reproduce this issue in #480. It also blocking us.

maniek45 avatar Feb 22 '19 05:02 maniek45

@xurui8691413 you sample needs some updating. First you should be using a release of Finchley and not a release candidate. Once you upgrade to Finchley.SR3 you need to correctly specify the URI in your route.

	@Bean
	public RouteLocator wsGateway(RouteLocatorBuilder builder) {
		return builder.routes()
				.route("ws", predicate -> predicate
						.path("/ws").filters(f ->f.setPath("/ws2"))
						.uri("ws://localhost:8080"))
				.build();
	}

Specifying the path in the URI no longer works, you need to use the setPath filter.

After changing that I see the problem, but unsure of the fix here. @spencergibb any ideas? Could this be a reactor problem?

ryanjbaxter avatar Feb 27 '19 21:02 ryanjbaxter

Related to Websocket ping #729

spencergibb avatar Mar 04 '19 15:03 spencergibb

@rstoyanchev we need to have a chat about this and ping.

spencergibb avatar Mar 04 '19 15:03 spencergibb

Any solution comes out?

DevDengChao avatar Mar 07 '19 03:03 DevDengChao

Not yet.

spencergibb avatar Mar 07 '19 15:03 spencergibb

Not yet.

sorry to ask ,when will this issue can be fixed?

xurui8691413 avatar Mar 18 '19 14:03 xurui8691413

I have to speak with the spring team first.

spencergibb avatar Mar 19 '19 19:03 spencergibb

any update on this issue?

maniek45 avatar Apr 01 '19 05:04 maniek45

any solution?

yingziisme avatar Jul 17 '19 08:07 yingziisme

过去一年了,解决这个问题了吗? 我也遇到了

It's been a year, has this problem been solved? I also met

acongy avatar Dec 17 '20 02:12 acongy

In my case, the problem was the angular client. Please refer following snippet.

this.ws = new SockJS('http://localhost:8080/websocket-server'); this.stompClient = Stomp.over(this.ws); this.stompClient.disconnect();

{ ... "code": 1005, "reason": "" ... }

it seems disconnect() method terminates websocket connection abnormally which results in status code 1005. to overcome this, I used following approach.

this.ws = new WebSocket('http://localhost:8080/websocket-server'); this.stompClient = Stomp.over(this.ws);

this.stompClient.unsubscribe(); this.ws.close(1000);

BhaveshLakhpati avatar Mar 29 '22 06:03 BhaveshLakhpati

Any updates on this issue?

inoublijamel avatar Jul 25 '22 21:07 inoublijamel