Custom Server Problems

Was told this was better suited for this thread than bug reporting. It's not an access problem, not along the lines of the rest posted in this thread anyway, but for completeness' sake:


  1. Windows 7
  2. Firefox 14
  3. Also tried the latest Chrome and Opera
  4. July 18th, maybe? I think that was around when I started trying this
  5. None yet, not that sort of issue
  6. Problem:


Anyway. I've been trying to set up my own server for some experiments, and so far I haven't been able to connect to it. I get the "You have been disconnected - possibly because the server was restarted." message right after it successfully contacts the login server. My firewall doesn't seem to be the problem, I'm reasonably certain I followed both the readme and Heroku's instructions correctly, and after a bit of poking around in the source and dev console I think I've identified the issue:

Code:
<script>
var server = '****.herokuapp.com';          var serverport = 8000; 
         [B]var serverprotocol = 'ws';[/B] 
         var urlPrefix = '~~****.herokuapp.com/'; 
         var down = false; 
         //if (!urlPrefix) down = true; 
         var oldie = false; 
     </script>
It's using the WebSockets protocol, which I believe Heroku doesn't support. In config.js, however, I did explicitly set the protocol to "io". I can access the main (Smogon) server just fine, and I'm assuming that's running with WebSockets since it's the recommended protocol. Looking further at the source HTML, it looks like the Socket.IO script is commented out—would that, or something similar, be the problem? That it's trying to use Socket.IO, is unable to, and then defaults back to WebSockets even though Heroku can't use that?

I'm still learning about working with Node and realize it's entirely likely that I screwed up somewhere along the line, but I just want to be sure. Thanks in advance! (And if there's a better way/place to ask for help with this sort of issue, just let me know.)
 
This really isn't a question for Tech Support, so I moved it to its own thread.

To answer your question, I believe Heroku's instructions are out-of-date (from before our switch off sockets.io). Hopefully someone like Zarel or bmelts will see this thread and be able to help you out.

Best of luck!
 

Zarel

Not a Yuyuko fan
is a Site Content Manageris a Battle Simulator Administratoris a Programmeris a Pokemon Researcheris an Administrator
Creator of PS
Looking through bmelts's code, it appears you should be doing:

play.pokemonshowdown.com/~~****.herokuapp.com:80|io

to connect to socket.io on port 80 (I believe Heroku forces port 80?)

Also, "ws" actually means "SockJS", which has a non-WebSockets fallback, same as socket.io
 
Ah, yep! That's done it. Sorry for the thread/post confusion, and thanks for the help!

EDIT: I was able to get the server running locally and sort of on Heroku, but I've run into several other problems:

First of all, when I try to test battles locally, the pokémon's movesets are all replaced with nothing but struggle:



and furthermore, struggle does no damage to the target and the user takes no recoil, as you can see from the log. The pokémon do have moves selected—I've even tried it in random battle so I know they should have autogenerated moves—and if you mouse over another pokémon in the team, you can see that it has its full list of four moves. The pokémon actually in battle can't do anything but struggle ineffectually, however.

After forfeiting the battle (since there's no way for either player to win if struggle does nothing), I get this error:

THE SERVER HAS CRASHED: TypeError: Cannot read property 'acre' of undefined
at update.update.room (drive:\path\rooms.js:87:31)
Please restart the server.
You will not be able to talk in the lobby or start new battles until the server restarts.
When I attempt to test online, I generally can't even get that far. Assuming the client can actually connect to my server in the first place instead of hanging (and that could very well be a problem on my end so I'm not worrying about it right now), I get the following error as soon as the connection is made:

THE SERVER HAS CRASHED: ReferenceError: selfP is not defined
at User.rename (/app/users.js:488:4)
Please restart the server.
You will not be able to talk in the lobby or start new battles until the server restarts.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top