Skip to content

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

Open
thend03 wants to merge 4 commits intoapitable:developfrom
thend03:fix_backend_server_notification_connection
Open

fix(backend-server): notification(non localhost) connect failed#1500
thend03 wants to merge 4 commits intoapitable:developfrom
thend03:fix_backend_server_notification_connection

Conversation

@thend03
Copy link
Copy Markdown

@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
Copy Markdown

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
Copy Markdown
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.

3 participants