I told myself I wasn’t going to inundate the web with an avalanche of posts today, but I feel like I need to make just this one while I have it in mind.

Although my knowledge of React is now passable, I am thinking about how to use it for the Trader Web game. As I might have mentioned, the key feature is the live communication between the client and server, which is currently handled with SignalR. In order for me to switch from POJS (Plain Old Javascript) to React, I need to find a way to replicate that event-driven communication.

My first attempt was to look into a Node-based game server. I found two, but I had issues with both — namely that I couldn’t get either of them installed on a virtual machine that I set up specifically so I wouldn’t have development crap all over my main OS at home.

This morning I simply searched for “React SignalR” and was given several ways of making the two work together. Apparently — on paper — it’s as simple as importing a SignalR client into the React app, pointing it at the SignalR proxy endpoint, and using the proper conventions to communicate. I anticipate something going horribly wrong.

The good news is that I can leverage the work I’ve already done with the all-in-one MVC version as far as the back-end is concerned. I will make a new project with the SignalR stuff in there, but won’t bother working with the front end. Maybe I can eventually leverage this front end for the pre-roll stuff like “what’s the game about?” and “register and create a character”. First and foremost it’ll be serving the endpoint for the service. Like a web API, but with real-time signaling abilities.

As much as I’d like to rely on a Node-based game server, I found myself slipping into “manic-mode” when thinking about it. Trying to remember everything I’d done with the game so far, translating it to TypeScript for the server, figuring out how to use the server which upon examination would become more complex than it seems on the surface, and continuing to further my React knowledge in the process was simply too many irons in the fire. My mind was everywhere at once, and it was giving me the shakes.

Scopique

Owner and author.

Leave a Reply

Your email address will not be published. Required fields are marked *