Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2015 22:28
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/574133a15f7faf39fdb5 to your computer and use it in GitHub Desktop.
Save anonymous/574133a15f7faf39fdb5 to your computer and use it in GitHub Desktop.
var app = require('express')();
var server = require('http').Server(app);
var io = require('socket.io')(server),
util = require('util'),
bodyParser = require('body-parser');
var port = process.env.port || 1337;
server.listen(port);
console.log("listening on port: " + port);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
app.post("/addNewTagToService", function (req, res) {
// look for parameters from form input
var data = {
ID: req.body.ID,
};
console.log("sending request to interperet new data");
// send the message to console app
io.emit("test",data);
res.send("OK");
});
@hanz05
Copy link

hanz05 commented Aug 3, 2021

This example was written in Node.js, not in a C# class. Please, change the header text to avoid a confuse!

@tuandmz-necvn
Copy link

For those who come here from Gist Search, this is an example of using C# to communicate with the socket.io server.

The full answer from Stack Overflow is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment