Created
December 18, 2015 22:28
-
-
Save anonymous/574133a15f7faf39fdb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
}); |
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
This example was written in Node.js, not in a C# class. Please, change the header text to avoid a confuse!