vinnyoodles / react-native-socket-io-example Goto Github PK
View Code? Open in Web Editor NEWA demo for implementing a mobile chatroom
A demo for implementing a mobile chatroom
Hi
I found this error when I try to run a demo.
I have completely installed all node modules, but I found this error.
I have googled for this error and find a solution that XMLHttpRequest work fine in IOS but my platform is Android- 5.0.1.
Thank you.
node_modules\mongodb\lib\utils.js:123
process.nextTick(function() { throw err; });
^
TypeError: Cannot read property 'emit' of null
I am getting document is not defined. Following is how I implemented it.
Image: http://i66.tinypic.com/2n6swp3.png
import React, { Component } from 'react'
import { View, Text, Image, ScrollView } from 'react-native'
import SocketIOClient from 'socket.io-client';
class Game extends Component {
constructor(props) {
super(props)
this.socket = SocketIOClient('http://localhost:8008');
this.socket.on('message', this.onReceivedMessage);
}
// Event listeners
/**
* When the server sends a message to this.
*/
onReceivedMessage(messages) {
alert(message)
}
render() {
console.log('rerendered!!!!')
return(
<View style={{flex:1}}>
....
</View>
)
}
}
export default Game
D:\react-native-socket-io\node_modules\mongodb\lib\mongo_client.js:421
throw err
^
MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
at Pool. (D:\react-native-socket-io\node_modules\mongodb-core\lib\topologies\server.js:336:35)
at Pool.emit (events.js:159:13)
at Connection. (D:\react-native-socket-io\node_modules\mongodb-core\lib\connection\pool.js:280:12)
at Object.onceWrapper (events.js:254:19)
at Connection.emit (events.js:159:13)
at Socket. (D:\react-native-socket-io\node_modules\mongodb-core\lib\connection\connection.js:189:49)
at Object.onceWrapper (events.js:254:19)
at Socket.emit (events.js:159:13)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
Hi. I'm trying to build this on the Expo IDE. There seems to be no error but when the app is deployed to the android device, it states the following error:
|this| is not a function inside Function.prototype.bind
Could you please help?
react-native-socket-io-example-master/node_modules/mongodb/lib/mongo_client.js:224 throw err ^
I want to upload files (Images) on node server using socket.io
Is the application is production ready for android ? please guide ? can we integrate the firebase ? how ? how to send the queries to Linux server ?
var http = require('http') http undefined. can i create socketServer on RN app?
Not receiving message from terminal to android device, on ios working fine
I get the following error:
_npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "server"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! missing script: server
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\GV\Desktop\Native\sos\npm-debug.log_
My debug log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'server' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: server
4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:151:19)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:61:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:356:5
4 verbose stack at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:320:45)
4 verbose stack at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:354:3)
4 verbose stack at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:124:5)
4 verbose stack at ReadFileContext. (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:308:29)
4 verbose stack at ReadFileContext.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16)
4 verbose stack at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)
5 verbose cwd C:\Users\GV\Desktop\Native\sos
6 error Windows_NT 10.0.15063
7 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "server"
8 error node v6.3.1
9 error npm v3.10.3
10 error missing script: server
11 error If you need help, you may report this error at:
11 error https://github.com/npm/npm/issues
12 verbose exit [ 1, true ]
Hi,
This example is working fine in iOS but in android it is not at all working .
How Can I solve this?
Please help me in solving this
Thanks for the article, really helpful! However, did you run this on a mobile device or only within the simulator?
I'm running into an error which lead me to this SO comment and was wondering if you ever ran it on a device.
http://stackoverflow.com/questions/39427929/socket-io-not-working-with-react-native-on-android
I had cloned this repo and tried to build it with xcode. But it get stuck at "Building reactnativesocketexample: RCTText | Creating static library".
Does anyone have any suggestion about this?
thanks in advance!!!1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.