Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend-server): notification(non localhost) connect failed #1500

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

thend03
Copy link

@thend03 thend03 commented Dec 1, 2023

fix backend-server connect to SOCKET_URL(non localhost address) failed without transports configured

Why?

When I deployed room-server in my test environment, I found that the connection from local backend-server to notification is false, which means that the ws connection is failing
After troubleshooting, I found that I need to add the following configuration for the connection to succeed

opts.transports = new String[]{"websocket"}; 

What?

If the backend-server connects to the local room-server, the connection succeeds with or without transports.
If the backend-server connects to a non-local room-server, you need to add a transports configuration for the connection to succeed.
So in order to connect successfully, the transports configuration is added.

How?

add starter.socketio.client.transports=websocket in application.yml

add private List<String> transports = Collections.singletonList("websocket"); and getter/setter in com.apitable.starter.socketio.autoconfigure.SocketioProperties.Client

add options.transports= client.getTransports().toArray(new String[0]); in com.apitable.starter.socketio.autoconfigure.SocketioAutoConfiguration#createInstance

…) connect fail

if the backend-server connects to the address configured in SOCKET_URL, which is not the local process address, in the absence of transports configuration, the connection fails and the notification cannot be sent over the ws connection.
@CLAassistant
Copy link

CLAassistant commented Dec 1, 2023

CLA assistant check
All committers have signed the CLA.

@ChambersChan ChambersChan changed the title fix(backend-server): fix backend-server to notification(non localhost) connect failed fix(backend-server): notification(non localhost) connect failed Dec 15, 2023
@ChambersChan
Copy link
Collaborator

It is recommended not to add configured default values. Modify the transports attribute only when the configuration is not empty. This also does not affect the default initialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants