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

[Android] WebSocket support #2837

Closed
satya164 opened this Issue Sep 18, 2015 · 14 comments

Comments

Projects
None yet
@satya164
Collaborator

satya164 commented Sep 18, 2015

It would be cool to have WebSockets implemented on Android too.

I've implemented a basic working sample with Native Module, but not sure how to contribute to the code to React Native. Any guidance will be appreciated.

satya164 added a commit to callstack-internal/react-native that referenced this issue Sep 18, 2015

@satya164

This comment has been minimized.

Show comment
Hide comment
@satya164

satya164 Sep 18, 2015

Collaborator

Okay, I sent a pull request, but I have no idea how to write tests. Could you point me to some docs?

Collaborator

satya164 commented Sep 18, 2015

Okay, I sent a pull request, but I have no idea how to write tests. Could you point me to some docs?

satya164 added a commit to callstack-internal/react-native that referenced this issue Sep 18, 2015

@foghina foghina added the Android label Sep 18, 2015

satya164 added a commit to callstack-internal/react-native that referenced this issue Oct 1, 2015

Implement WebSocket module for Android. Fixes #2837
Add a message property to error event

Use okhttp-ws for WebSocket

Added comments about the status code

Specify reason to close socket on JavaScript side

Pass extra parameters to close

Change 'WebSocketManager' to 'WebSocketModule'

Change reactContext to mReactContext

Change timeouts as per react native JS debugger

Better error handlng

Explain executor shutdown

satya164 added a commit to callstack-internal/react-native that referenced this issue Oct 2, 2015

Implement WebSocket module for Android. Fixes #2837
Add a message property to error event

Use okhttp-ws for WebSocket

Added comments about the status code

Specify reason to close socket on JavaScript side

Pass extra parameters to close

Change 'WebSocketManager' to 'WebSocketModule'

Change reactContext to mReactContext

Change timeouts as per react native JS debugger

Better error handlng

Explain executor shutdown
@Tjorriemorrie

This comment has been minimized.

Show comment
Hide comment
@Tjorriemorrie

Tjorriemorrie Oct 2, 2015

What's the status of this? Is it possible to use this at least for dev?

Tjorriemorrie commented Oct 2, 2015

What's the status of this? Is it possible to use this at least for dev?

@mkonicek

This comment has been minimized.

Show comment
Hide comment
@mkonicek

mkonicek Oct 2, 2015

Contributor

@Tjorriemorrie Will be merging this today.

Contributor

mkonicek commented Oct 2, 2015

@Tjorriemorrie Will be merging this today.

@mkonicek

This comment has been minimized.

Show comment
Hide comment
@mkonicek

mkonicek Oct 7, 2015

Contributor

Took longer than expected but it's finally in!

Contributor

mkonicek commented Oct 7, 2015

Took longer than expected but it's finally in!

@ide

This comment has been minimized.

Show comment
Hide comment
@ide

ide Oct 7, 2015

Collaborator

@satya164 @mkonicek awesome work guys!

Collaborator

ide commented Oct 7, 2015

@satya164 @mkonicek awesome work guys!

@chirag04

This comment has been minimized.

Show comment
Hide comment
@chirag04

chirag04 Oct 7, 2015

Collaborator

kudos guys! 👍

Collaborator

chirag04 commented Oct 7, 2015

kudos guys! 👍

@chemuto

This comment has been minimized.

Show comment
Hide comment
@chemuto

chemuto Oct 10, 2015

Hi guys. I am trying to connect react native on android with meteor using this ddp client https://github.com/hharnisc/node-ddp-client.
I am getting an error (Cannot read property 'connect' of undefined) at Websocket.js:35:0 (connectToSocketImpl):
RCTWebSocketModule.connect(url, this._socketId);
I am using the react native master branch at 9f1dab6

Am I doing something wrong or should this thing be working?
Thanks

screenshot react native error

chemuto commented Oct 10, 2015

Hi guys. I am trying to connect react native on android with meteor using this ddp client https://github.com/hharnisc/node-ddp-client.
I am getting an error (Cannot read property 'connect' of undefined) at Websocket.js:35:0 (connectToSocketImpl):
RCTWebSocketModule.connect(url, this._socketId);
I am using the react native master branch at 9f1dab6

Am I doing something wrong or should this thing be working?
Thanks

screenshot react native error

@satya164

This comment has been minimized.

Show comment
Hide comment
@satya164

satya164 Oct 10, 2015

Collaborator

@chemuto Are you sure that both Java and JavaScript code are in sync?

Collaborator

satya164 commented Oct 10, 2015

@chemuto Are you sure that both Java and JavaScript code are in sync?

@chemuto

This comment has been minimized.

Show comment
Hide comment
@chemuto

chemuto Oct 11, 2015

@satya164 Thanks for your answer. How can I configure/check that?

chemuto commented Oct 11, 2015

@satya164 Thanks for your answer. How can I configure/check that?

@mikemintz

This comment has been minimized.

Show comment
Hide comment
@mikemintz

mikemintz Oct 11, 2015

I get a similar error trying websocket after installing react-native npm module directly from github: [TypeError: undefined is not an object (evaluating 'RCTWebSocketModule.connect')]

mikemintz commented Oct 11, 2015

I get a similar error trying websocket after installing react-native npm module directly from github: [TypeError: undefined is not an object (evaluating 'RCTWebSocketModule.connect')]

@satya164

This comment has been minimized.

Show comment
Hide comment
@satya164

satya164 Oct 11, 2015

Collaborator

@chemuto @mikemintz You also need to configure gradle to compile the version you installed instead of the version from maven.

e.g.- compile project(':ReactAndroid') rather than compile com.facebook.react:react-native:0.12.+

Collaborator

satya164 commented Oct 11, 2015

@chemuto @mikemintz You also need to configure gradle to compile the version you installed instead of the version from maven.

e.g.- compile project(':ReactAndroid') rather than compile com.facebook.react:react-native:0.12.+

@ansarizafar

This comment has been minimized.

Show comment
Hide comment
@ansarizafar

ansarizafar Oct 17, 2015

@chemuto Is ddp client working for you? I also want to use Meteor backend for my reactnative android app.

ansarizafar commented Oct 17, 2015

@chemuto Is ddp client working for you? I also want to use Meteor backend for my reactnative android app.

@tgoldenberg

This comment has been minimized.

Show comment
Hide comment
@tgoldenberg

tgoldenberg Oct 27, 2015

Contributor

@ansarizafar @chemuto Second that, it would be a huge breakthrough if we can use ddp-client with Android. Please respond to the SO post

Contributor

tgoldenberg commented Oct 27, 2015

@ansarizafar @chemuto Second that, it would be a huge breakthrough if we can use ddp-client with Android. Please respond to the SO post

@chemuto

This comment has been minimized.

Show comment
Hide comment
@chemuto

chemuto Oct 29, 2015

I just did a small test and seemed to be working. At least a was able to do
a connect through ddp to my meteor server. I will try again when I have
some free time cause I would also like to develop in RN using the meteor
backend.

On Tue, Oct 27, 2015 at 1:50 PM, Thomas Goldenberg <notifications@github.com

wrote:

@ansarizafar https://github.com/ansarizafar @chemuto
https://github.com/chemuto Second that, it would be a huge breakthrough
if we can use ddp-client with Android. Please respond to the SO post
http://stackoverflow.com/questions/33360674/react-native-ddp-connection-for-android


Reply to this email directly or view it on GitHub
#2837 (comment)
.

chemuto commented Oct 29, 2015

I just did a small test and seemed to be working. At least a was able to do
a connect through ddp to my meteor server. I will try again when I have
some free time cause I would also like to develop in RN using the meteor
backend.

On Tue, Oct 27, 2015 at 1:50 PM, Thomas Goldenberg <notifications@github.com

wrote:

@ansarizafar https://github.com/ansarizafar @chemuto
https://github.com/chemuto Second that, it would be a huge breakthrough
if we can use ddp-client with Android. Please respond to the SO post
http://stackoverflow.com/questions/33360674/react-native-ddp-connection-for-android


Reply to this email directly or view it on GitHub
#2837 (comment)
.

MattFoley added a commit to skillz/react-native that referenced this issue Nov 9, 2015

Implement WebSocket module for Android. Fixes #2837
Summary: The JavaScript code for Android is same as the iOS counterpart, I just added few new lines and used arrow functions instead of binding `this`.
Closes facebook#2839

Reviewed By: @​svcscm, @vjeux

Differential Revision: D2498703

Pulled By: @mkonicek

fb-gh-sync-id: 3fe958dd5af0efba00df07515f8e33b5d87eb05b

Crash-- added a commit to Crash--/react-native that referenced this issue Dec 24, 2015

Implement WebSocket module for Android. Fixes #2837
Summary: The JavaScript code for Android is same as the iOS counterpart, I just added few new lines and used arrow functions instead of binding `this`.
Closes facebook#2839

Reviewed By: @​svcscm, @vjeux

Differential Revision: D2498703

Pulled By: @mkonicek

fb-gh-sync-id: 3fe958dd5af0efba00df07515f8e33b5d87eb05b

@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.