-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
35 lines (25 loc) · 796 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/************************************************************
NODE.JS INTERACTIVE IO
This is WEB interface for visa32test.js.
Author : 7M4MON
Date : 2015/04/24
Licence : MIT
************************************************************/
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var visa32test = require('./visa32test.js');
//visa32test.Visa32TestQuery('GPIB0::22::INSTR','*IDN?');
app.get('/',function(req,res){
res.sendfile('index.html');
});
var rcvMsg;
io.on('connection',function(socket){
socket.on('sendmsg',function(msg){
rcvMsg = visa32test.Visa32TestQuery(msg.addr,msg.cmd);
io.emit('recvmsg', rcvMsg);
});
});
http.listen(3000,function(){
console.log('listen 3000 port');
});