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

Make SDK realtime composable compatible with React Native #22105

Merged
merged 8 commits into from Apr 25, 2024

Conversation

paescuj
Copy link
Member

@paescuj paescuj commented Apr 5, 2024

Scope

Make the SDK realtime composable compatible with the WebSocket implementation of React Native, which only accepts string for the url parameter.

Potential Risks / Drawbacks

None

Review Notes / Questions

None


Fixes #22098

Copy link

changeset-bot bot commented Apr 5, 2024

🦋 Changeset detected

Latest commit: fc3d4bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@directus/sdk Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@paescuj paescuj requested review from a team, rijkvanzanten and DanielBiegler and removed request for a team April 5, 2024 13:56
@br41nslug br41nslug self-assigned this Apr 5, 2024
Copy link
Member

@br41nslug br41nslug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll want to update line 233 of the realtime composable instead so the WebSocket constructor gets a string with just a single .toString() cast.

const ws = new client.globals.WebSocket(url.toString());

Did a quick test with some of the most common websocket libraries (SockJs/WS/uWebSockets/BunWS) and looks like a string should not be an issue there 😄

.changeset/lucky-rivers-taste.md Outdated Show resolved Hide resolved
sdk/src/types/globals.ts Outdated Show resolved Hide resolved
sdk/src/realtime/composable.ts Outdated Show resolved Hide resolved
sdk/src/realtime/composable.ts Outdated Show resolved Hide resolved
sdk/src/types/globals.ts Outdated Show resolved Hide resolved
@useEffects

This comment was marked as off-topic.

@br41nslug

This comment was marked as off-topic.

sdk/src/realtime/composable.ts Outdated Show resolved Hide resolved
sdk/src/types/globals.ts Outdated Show resolved Hide resolved
@br41nslug br41nslug enabled auto-merge (squash) April 25, 2024 18:49
@br41nslug br41nslug merged commit 721de01 into main Apr 25, 2024
4 checks passed
@br41nslug br41nslug deleted the sdk-react-native-websocket branch April 25, 2024 18:50
@github-actions github-actions bot added this to the Next Release milestone Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Realtime sdk not working in android emulator
3 participants