SocketChat
1.0.0
Socket.io 및 Android를 사용하는 간단한 채팅 앱. 12-5-2021에서 만들어졌습니다
1. Socket.io의 종속성을 빌드 할 수 있습니다. Gradle :
dependencies {
...
implementation 'com.github.nkzawa:socket.io-client:0.6.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}
2. AndroidManifest.xml에 대한 인터넷 허가.
<uses-permission android:name="android.permission.INTERNET"/>
3. nodejs를 사용하여 서버를 생성합니다
var socketIO = require('socket.io'),
http = require('http'),
port = process.env.PORT || 6000, // Port
ip = process.env.IP || '10.10.10.18', // My IP address
server = http.createServer().listen(port, ip, function() {
console.log("IP = " , ip);
console.log("start socket successfully");
});
io = socketIO.listen(server);
//io.set('match origin protocol', true);
io.set('origins', '*:*');
npm start
ipconfig