Skip to content

Commit

Permalink
测试阶段
Browse files Browse the repository at this point in the history
  • Loading branch information
caozhihui4399 committed Oct 17, 2018
1 parent 5e71a6b commit e401eb3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
16 changes: 12 additions & 4 deletions client.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env node
const {isDev,dev,pro} = require('./config');
const config = isDev ? dev : pro;
let {serverHost,host,serverPort} = config;
let net = require('net');
let io = require('socket.io-client');
let request = require('request');
var prompt = require('prompt');
const serverHost = "http://service.wkdl.ltd";
const host = 'http://www.wkdl.ltd';
//const serverHost = "http://localhost";
const serverPort = "80";

//
// Start the prompt
Expand Down Expand Up @@ -60,12 +60,19 @@ class Client{
socket.on('disconnect', () => {
console.log('断开');
});
/* socket.on('message/headerEnd', (data) => {
console.log('浏览器告诉我结束了。。。。');
let {name} = data;
socket.emit('message/end', {
name: name,
buffer: null
})
});*/
socket.on('connect', () => {
console.log('socket.io server connected');
socket.on('message', data => {
let {name,buffer} = data;
let clientFree = client[name];
console.log(data);
if (!name) {
return;
}
Expand All @@ -85,6 +92,7 @@ class Client{
})
});
clientFree.on('end', () => {
console.log('我结束了');
socket.emit('message/end', {
name: name,
buffer: null,
Expand Down
13 changes: 13 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports= {
isDev : true,
dev : {
serverPort : 3838,
host : 'http://www.wkdl.ltd',
serverHost : 'http://127.0.0.1'
},
pro : {
serverPort : 80,
host : 'http://www.wkdl.ltd',
serverHost : 'http://service.wkdl.ltd'
}
}

0 comments on commit e401eb3

Please sign in to comment.