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

Including Protocol Parameter in Socket Connection Creation in iOS #4923

Open
Abhishekchugh01941 opened this issue Jan 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Abhishekchugh01941
Copy link

Abhishekchugh01941 commented Jan 17, 2024

Problem:
I am currently facing difficulties in establishing a socket connection from my iOS app due to the absence of a parameter to specify the sub-protocol during the socket creation process. This is particularly problematic as I need to connect using the 'graphql-ws' sub-protocol, and the current implementation lacks support for this.

The addition of a parameter in the socket creation process that allows users to specify the desired sub-protocol, particularly for cases like mine where 'graphql-ws' is required. This can be added while creating socket Manager object where socket url and configuration are declared.

Our web team has implemented socket connections in the Angular framework, and they are utilizing the 'graphql-ws' sub-protocol.
new WebSocket(url, ['graphql-ws']);

Refer to the following link:
https://stackoverflow.com/questions/74276986/websocket-connection-to-appsync-errorcode-400-noprotocolerror

@Abhishekchugh01941 Abhishekchugh01941 added the enhancement New feature or request label Jan 17, 2024
@darrachequesne
Copy link
Member

Hi! You can provide a protocols option, which will be forwarded to the WebSocket constructor.

const socket = io({
  transports: ["websocket"],
  protocols: ["graphql-ws"]
});

Reference: https://socket.io/docs/v4/client-options/#protocols

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

No branches or pull requests

2 participants