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

React Native Chat Example #303

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

Conversation

nivoc
Copy link
Contributor

@nivoc nivoc commented Apr 29, 2016

For #285


This change is Reviewable

nivoc and others added 3 commits April 29, 2016 12:51
Improved Readme with Issue-Links
Changed vi command in README that vi jumps direktly onto the right line in auth.js
@deontologician deontologician added this to the Examples milestone Apr 29, 2016
@deontologician
Copy link
Contributor

Awesome! Thanks for submitting this PR

@dalanmiller
Copy link
Contributor

Hey @nivoc would you mind adding me as a collaborator on your fork so I can check out your branch?

cc: @mglukhovsky ^

@nivoc
Copy link
Contributor Author

nivoc commented Apr 29, 2016

@dalanmiller Sure. Added.

@nivoc
Copy link
Contributor Author

nivoc commented Apr 29, 2016

It sometime fails to connect (about 1 out of 10 times). Not sure yet why. Looks like some timing issue. Refresh helps (cmd+r in the simulator).

@dalanmiller
Copy link
Contributor

This is awesome @nivoc thank you. @mbseid could you show us how you got around auth/token/AsyncStorage?

@dalanmiller
Copy link
Contributor

Note: I've never done anything with react-native so the tool chain is new to me.

To get the example to run properly I had to run the npm start commands separately and there was maybe a race condition with the cli.js not being ready first I think. Not doing this gave me this error:

screenshot 2016-04-29 12 22 07

=== BUILD TARGET ReactNativeChatAppTests OF PROJECT ReactNativeChatApp WITH CONFIGURATION Debug ===

Check dependencies

** BUILD SUCCEEDED **

Installing build/Build/Products/Debug-iphonesimulator/ReactNativeChatApp.app
Launching org.reactjs.native.example.ReactNativeChatApp
org.reactjs.native.example.ReactNativeChatApp: 8227
events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: This socket is closed.
    at Socket._writeGeneric (net.js:662:19)
    at Socket._write (net.js:714:8)
    at doWrite (_stream_writable.js:300:12)
    at writeOrBuffer (_stream_writable.js:286:5)
    at Socket.Writable.write (_stream_writable.js:214:11)
    at Socket.write (net.js:640:40)
    at Console.log (console.js:39:16)
    at process.<anonymous> (server.js:124:15)
    at emitOne (events.js:90:13)
    at process.emit (events.js:182:7)

Then once I had it going I could save and write to the database but it looks like the changefeed isn't working properly:

screenshot 2016-04-29 12 31 01
screenshot 2016-04-29 12 31 00

The console output above shows I'm typing things into it and they're being stored but nothing is returning to the view?

I might've missed something just let me know what I need to fix here @nivoc. This thing was surprisingly easy to get setup and build, react-native is really quite cool thank you for PRing this.

@nivoc
Copy link
Contributor Author

nivoc commented Apr 29, 2016

@dalanmiller oh good to know. Yes it sound's like a 'not ready'. Works for me - but I may have been lucky with the timing on my machine :-)

About the Changefeed issue:
Try to press Command+r on the "no messages yet" screen.

There is an issue. I was not able to track it down yet. For me it works in 9 out of 10 connects but it's may be worse on your system. Press Command+R several times. But yes - needs to be fixed ;-)

@deontologician
Copy link
Contributor

Another thing is that the config.toml shouldn't be committed, since it has a token secret in it. I think it's good to have a convention that config.toml files never make it into the repo proper, to avoid confusion

@nivoc
Copy link
Contributor Author

nivoc commented May 2, 2016

removed.

About the Changefeed-Issue. It's odd. The "watch"-subscription gets called on every start. And it's always possible to write. But sometimes does the horizon not return the values.

@dalanmiller
Copy link
Contributor

I wonder if this is some artifact of WebSockets acting weird natively? Have you had other projects that use WebSockets without issues @nivoc or is this unique to Horizon?

@nivoc
Copy link
Contributor Author

nivoc commented May 4, 2016

@dalanmiller I haven't used WebSockets in RN enough to tell.
But at least there are no open Issues in RN that sound like it: https://github.com/facebook/react-native/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+websocket

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

Successfully merging this pull request may close these issues.

3 participants