0

this one is a bit tricky to explain, but for simplicity's sake, lets say I have a website (it doesn't have to be html or php or anything, I'm comfortable with most languages) where there are two buttons, yes or no. in order to see the buttons, you would need to have an account and login to load the page that loads the buttons (I've done this part). the buttons, for the grand majority of time, would be hidden and deactivated. However, when I somehow send a command from my computer, the buttons would become visible and the user would be able to make a choice. In this case, the transition would have to be in real time, so the user would not have to reload the page to see if the buttons are usable again. I would then be able to deactivate them again and start again.

I've been looking around the net for solutions for this for the past two days but I can't wrap my head around it. the closest I've come is to using socket.io but I think I might be overlooking another solution that I don't even know about. These commands would have to fire from unity3d, and the socket scripts made for it are outdated and difficult to get working. Am I missing something?

Captain Dando
  • 497
  • 2
  • 11
  • 30
  • 1
    Web sockets are indeed what you're looking for. – xlecoustillier Feb 12 '16 at 08:18
  • I'm not too clued up on websockets, but are the commands used for socket.io the same commands as just about any websocket extension? for example, if I use some other plugin for unity that supports websockets, and for example, do something like gameObject.emit(), will socket.io receive and process it alright? – Captain Dando Feb 12 '16 at 10:48

1 Answers1

1

Web sockets support the type of functionality you are describing, but before web sockets came along, other techniques, like polling provided the appearance of getting an uninitiated message from the server. This works by essentially repeatedly asking for any changes by the server. Modern day applications that implement sockets will still fall back on polling when necessary. This would be another option to consider.

This site describes it well and this stack overflow answer give a good high level description of outdated techniques and why web sockets are the the way to go if possible...

"To overcome this deficiency, Web app developers can implement a technique called HTTP long polling, where the client polls the server requesting new information. The server holds the request open until new data is available. Once available, the server responds and sends the new information. When the client receives the new information, it immediately sends another request, and the operation is repeated. This effectively emulates a server push feature."

Al Baker
  • 133
  • 7