node.js - Sending script from client to server to client on a web game -
there's simple smartfoxserver based web game im trying send scripts client<->server isn't quite working, appreciated!
when try run nothing happens , makes me run again.
var net = require('net'); var express = require('express'); var ajconnection; var io = require ('socket.io') var app = express(); app.use(express.static('c:\\users\\tyree\\desktop\\animaljamwip')); var server = net.createserver(function(c) { //'connection' listener flashconnection = c; console.log('flash connected, connecting aj'); // connect aj when flash connects node ajconnection = net.connect(443, '52.42.109.183', function () { console.log('aj connected'); io.sockets.on("connection",function(socket) { var message_to_client = { data: "connection server established" } socket.send(json.stringify(message_to_client)); console.log('socket.io connection client established'); socket.on("ajconnection.send(data)", function (data) { data = json.parse(data); console.log(data); /*printing data */ var ack_to_client = { data: "server received message" } socket.send(json.stringify(ack_to_client)); ajconnection.send(data) }); }); }); variable = "io.listen(server)" });
c:\users\tyree\desktop\animaljamwip>node server1.js c:\users\tyree\desktop\animaljamwip>
so wondering doing wrong followed guide changed game, want simple things such replacements e.g
d.replace(/player_den.playerden_free/g, function(room_main){ var dens = d.replace('player_den.playerden_free', 'room_main') c.write(dens); })
Comments
Post a Comment