8 Player Texas Hold Em - How do i pull the data to each .html

I want to have 9 different HTML logins. 1 for the community cards to be displayed and then 8 other people who login to /player1 /player2 /player3 etc. I am only using the example and I am running into a road block. I have been reading and searching forums. I can send the topic successfully back to the player1.html but i don't know how to capture the values from it.

I am using a sql backend to shuffle and track all of my poker data. I am sure this is something simple but would love any help. Posting code probably will not help because I am not too far off from the saimple. I made a player1.html and copied the contents of the other one.

UIBuilder is pretty amazing

In concept:

Create 1 page.
All players will use that page but use something like querystring parameters to indicate who is who.
Send all the data to that page with mappings like {player:1, cards:[]}.
In the page: if player === x then do stuff, same for sending back.

I appreciate that but i don't think i could pull that off. i want to store all the data inside of sql. my idea is that i click "deal new deck" and it just shuffles and sends out a new hand and pulls from sql.

I don't knw how to use elementid i think or something

You are lucky that you are starting this project now rather than 6 months ago :grin:

You will want to turn on one of the advanced options in uibuilder:

Turning on the "include msg._uib" option will result in you getting some additional information back from the client when you send a msg back to Node-RED:

image

As you can see, you get the pageName and a clientId. Your initial focus should probably simply be the page name. If you wanted some additional security, you could also check that each page comes from the same client id.

You guys are great, thank you. I am going to try this tonight and see if i can make some progress. This gives me a lot of hope. Are there any examples of something that would be somewhat similar to this? pulling data from a sql db and then sending it to multiple pages?


okay so i turned that on but then i turned it back off because i wanted to see what it actually did and i noticed that it already has the file name in the log files.

SELECT * FROM hands WHERE hand-id = 4

So i can send this successfully back to index.html and the query runs, but i don't know what to do with the output. I'm just doing "heads up " for right now, so i ust need to send this array to the player templates i made. I am just going to make 8 different templates, so 9 different templates.

I need one template to display the community cards in the middle of the table and then yeah, i just need a player template per player.

My idea is that they load ./player1.html and ./player2.html and that activates them inside of the sql database. My sql query would just have a AND with "IsPlaying" != null.

That way when we hit "deal new hand" it will only deal out cards for those that are marked as ready.

I am doing something very similar to this in another project but i'm not using UIBuilder and i just need a little bit more XP in doing this html stuff as well

You are looking at a control msg there and yes, that already has the data. But if you want to track user actions, you will want the data on the standard messages as well.

You may need to track, in node-red, the mapping between the player page and the socket id. The easiest way to send a message to a specific player will be to include the msg._socketId when you pass the msg to uibuilder. That way it will only go to that connection. Just note that if a player were to loose their connection to Node-RED and then it restarts (e.g. the device went to sleep for a while), the socket id will change. That's why you need a mapping with the page name.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.