Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 在NodeJS应用程序中使用内置套接字_Node.js_Sockets - Fatal编程技术网

Node.js 在NodeJS应用程序中使用内置套接字

Node.js 在NodeJS应用程序中使用内置套接字,node.js,sockets,Node.js,Sockets,我设计了一个正常工作的NodeJS应用程序,它正确地使用FFMPEG进行视频转换。我在使用socket.io时运气不太好,所以我想在Node中使用本机socket类。这是迄今为止我的节点应用程序具体地说,我需要在('end',function()”上的“中发送套接字事件或消息 var ffmpeg = require('./lib/fluent-ffmpeg'); var express = require('express'), multer = require('multer'

我设计了一个正常工作的NodeJS应用程序,它正确地使用FFMPEG进行视频转换。我在使用socket.io时运气不太好,所以我想在Node中使用本机socket类。这是迄今为止我的节点应用程序
具体地说,我需要在('end',function()”上的“中发送套接字事件或消息

var ffmpeg =  require('./lib/fluent-ffmpeg');

var express = require('express'),
    multer  = require('multer');
var app = express();

//auto save file to uploads folder
app.use(multer({ dest: './uploads/'}))
var temp;

app.post('/', function (req, res) {
    console.log(req.body); //contains the variables
    console.log("req.files ="+ req.files); //contains the file references

console.log("req.files.Filedata.path ="+ req.files.Filedata.path ); 

temp=req.files.Filedata.path;
console.log("temp ="+temp);


// make sure you set the correct path to your video file
var proc = ffmpeg('./'+temp)

  // set audio bitrate
  .audioBitrate('128k')
  // set audio codec
  .audioCodec('libmp3lame')

  // set output format to force
  .format('avi')
  // setup event handlers
  .on('end', function() {
    console.log('file has been converted succesfully');
  })
  .on('error', function(err) {
    console.log('an error happened: ' + err.message);
  })
  // save to file
  .save('./converted/converted.avi');
    res.send('Thank you for uploading!');

});

app.listen(8080); 

你没有在应用程序中使用套接字…你试图与之通信的另一端是什么?在这种情况下,套接字只是网络连接,而不是你可以用来与web浏览器通信的东西,这看起来就像你正在尝试做的。不,我不是与web浏览器通信,而是与桌面通信op(空气)应用。