Skip to content
Browse files

server.js più pulito e uso di localaddress in post.html

  • Loading branch information...
1 parent 932fbdf commit 2058f55760152db9158c070adacee3df33614022 @mikosh75 committed
Showing with 8 additions and 3 deletions.
  1. +2 −2 public/post.html
  2. +6 −1 server.js
View
4 public/post.html
@@ -27,7 +27,7 @@
<script type="text/javascript" charset="utf-8">
(function($) {
-
+ var localaddress = window.location.host;
var urlParams = {};
(function () {
var e,
@@ -106,7 +106,7 @@
//alert (dataString);return false;
$.ajax({
type: "POST",
- url: "http://localhost:8000/message",
+ url: "http://" + localaddress + "/message",
data: dataString,
success: function() {
$('#stato').text("messaggio inviato!").show().fadeOut(500);
View
7 server.js
@@ -28,7 +28,12 @@ app.configure('production', function(){
});
app.post('/message', function(req, res) {
- bayeux.getClient().publish('/channel/' + req.body.ch, { text: req.body.text, timestamp: req.body.timestamp, ch: req.body.ch, clientid: req.body.clientid });
+ bayeux.getClient().publish('/channel/' + req.body.ch, { text : req.body.text,
+ timestamp: req.body.timestamp,
+ ch: req.body.ch,
+ clientid: req.body.clientid
+ }
+ );
res.send(200);
});

0 comments on commit 2058f55

Please sign in to comment.
Something went wrong with that request. Please try again.