Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8811597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:24:16+00:00 2026-06-14T03:24:16+00:00

So basically I’m making a simple RTS board game with node.js/express/socket.io for a learning

  • 0

So basically I’m making a simple RTS board game with node.js/express/socket.io for a learning experience. So far it’s going really well and I though I was almost there working purely on the localhost. Deployed it to nodejitsu and loaded the page up, but the server isn’t sending the initial server data to the client. If (while the page is open, no refresh) I reset the server it then establishes connection and the whole thing works as expected, but a client visiting the server doesn’t do it.

Server init code:

    var express = require('express');
var app = require('express')()
  , server = require('http').createServer(app)
  , io = require('socket.io').listen(server);


server.listen(8080);

app.use(express.static(__dirname + '/public'));
app.get('/', function(req, res){

    res.sendfile("index.html");

});

app.get('/RTSwords', function(req, res){

    //res.sendfile("public\\RTSwords.html");
    res.sendfile("RTSwords.html");

});

Server socket.io code

// define interactions with client
io.sockets.on('connection', function(socket){
    //send them board and first seven tiles.

    socket.emit('serverNews', {'game': JSON.stringify(gameBoard), 'newTiles': randomTileString(7)});

And client socket.io code

var socket = io.connect('http://MYURLHERE');
.......
socket.on('serverNews', function(data){
            update(data);
        });

So yeah,in summary it works locally, works when page is loaded and server is restarted (I’m just “jistu deploy”ing to do that) but not when server is running then page is loaded.

Any help would be much appreciated!

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:24:17+00:00Added an answer on June 14, 2026 at 3:24 am

    On the client use io.connect() , if you need more help join #nodejitsu on IRC, http://webchat.jit.su or irc://chat.freenode.net/#nodejitsu

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I am writing a simple bit of code to increment every one second
Basically I'm making a filter for my portfolio so that you can click on
Basically my question is, if I have a number string, and i'm going to
Basically I have some simple code that does some things for files and I'm
Basically what I'm trying to do is make a very simple vertical bullet projectile
Basically I'm going to go a bit broad here and ask a few questions
Basically, I want to inform a C++ application (a game application) when an event
Basically I need to get older version of a file in the repository without
Basically I want to check the extended permissions the user has granted my app.
Basically I want to convert a virtual path to an absolute path.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.