Sockets
-
I know that this keeps being delayed and delayed, so may I ask the status of this?
I figure it should be an easy code, but getting the syntax to match hyperPads, while maintaining ease of use might not be so easy, based off of my C# and Python networking. I know you use C++ and C though, as well, neither of the two others.
99% of my games are supposed to be online based, but no internet connectivity means no games :(
-
Will be really cool when the HTTP interaction, if thats what it's called, comes out, but I hear HTTP is quite slow, I don't know how online stuff works but would be really cool if real time online games were possible in hyperPad (online, wifi, some games have bluetooth multiplayer).
-
The next update is getting HTTP Requests, 2 legged OAuth2 authentication, and socket.io integration for Developer users.... also some non network related goodies for everyone else.
Now, I know what some of you are going to say: "Oh why socket.io and not just raw web sockets because I can do such and such and I can code server stuff!"
-
Socket.io is open source and you can implement their protocol on your language of choice if you want. (usually there is already one available... eg search python socket.io on google)
-
It is so much easier to work with than other implementations. You don't need to deal with incomplete streams, knowing when the data is finished sending etc. It just works.
-
You can get away using socket.io for free!
-
there are a lot of simple and easy examples on getting up and running with socket.io.
-
It is a lot easier for us to roll out the feature this way.
-
-
@Aidan-Oxley said in Sockets:
Will be really cool when the HTTP interaction, if thats what it's called, comes out, but I hear HTTP is quite slow, I don't know how online stuff works but would be really cool if real time online games were possible in hyperPad (online, wifi, some games have bluetooth multiplayer).
Http requests and sockets are different.
Http requests are slower and not meant for multiplayer. It's more more pulling specific data (or sending).
Sockets is for multiplayer games. You set up a connection and data is streamed in real time while that connection is made.
-
Will be interesting to see how this works, I will probably wanna start making one of my games multiplayer online as soon as it comes out 😀
-
It's still pretty complicated. We take out a lot of the client side programming part. But you still need to set up a server, and do some server side programming. (applies for both http requests, and sockets).
While you wait, I'd suggest you look into setting up a server running socket.io (for multiplayer).I suggest looking at Heroku. They handle a lot of the server setting up part, you just need your own server side code set up (eg. If a high score system you will need write some code to handle storing scores in a database, or setting up socket.io on it). They offer free plan so you can do a lot for free until you're ready to pay, or move it to your own server when you're ready.
We'll try to have a couple tutorials to go with the http request and sockets (HTTP requests will probably have a tutorial on connecting to an API like weather-network, and a real time chat running on socket.io)
-
It looks to me like socket.io is web browser based, or rather "web application", and not freeform connection based, per say.
I'll bet you're going to call me out for not researching or something, but that's what I'm seeing, which is a bit of a disappointment for me.
I'm searching, and searching, and searching, but I can't seme to find a socket.io full implement for real time freeform connections in my, or any language actually, although I may be blind, or just flat out looking for the wrong things in the wrong places.
My infrastructure eventline should be;
[Client connects to host server> Host server finds and returns the connection and encryption information to the game> If the host server doesn't return "Maintenance", or "Unreachable", the client connects to the game server using the provided host address and requirement information> Initial handshake> Normal server/client communications and operations]That's impractical, yes, but it also allows for better organization and isolation of issues on my side, as well as the ability to monitor security in real time since my host and gameservers will be in two different places.
If @Murtaza or @Hamed could collaborate on the matter, that would be amazing :D
-
I'm not sure what you mean by web browser based. Socket.io is built on NodeJS which is a backend framework. You don't need to have a front end if you don't want to. Just skip the parts where the tutorials ask you to write html code and do those parts in hyperPad instead. Your "Web browser" will be hyperPad in this case ie. hyperpad is the front end client side, and your server would be the back end.
For your infrastructure, your initial encryption or what ever it is could be a simple HTTP request behavior, then the HTTP request would return you back your credentials, or link to the socket server, and feed that into the socket.io client behavior.
In any case, thats a little complicated to setup and outside of the scope of what we can help with.
-
I think what I am more concerned about is the data I need to set up server side and what hyperPad can handle, or if that's all on me.
Server side, it seems everyone wants me to use it like a web server, where you have index.html, a few js's, and several other PHP and HTMLs.
Additionally, I'm concerned about server privacy, it seems like either I should be able to build my own server, or it all goes through their servers, former being impossible.
Client side, does everything have to be JSON? I know that was discussed at one point, but I wasn't sure if I could manually build in handling or not.
I'm sure I'll figure out most of it should I have to, but getting set in the right direction would be wonderful.
-
You can send what ever kind of data you want. Its just easier to send JSON because you can feed it into the various Dictionary and Array behaviours.
You don't need to have it setup as a web server. Just skip those parts with the routing, index.html, js's or what ever else there is. Those are there because its just easier to provide a simple example that you can immediately see the effects of. eg. For the chat app example video that I made, I could have deleted all the public facing web code and it would have still worked perfectly.
Privacy concerns:
Those are all on you. You're building your own server, handle security however you see fit. There are a bunch of resources with free easy to use authentication/authorization libraries... I would start there. Also, I'm confused by what you mean by their servers. -
Their website implied at some point my data was sent to them, but I'll probably end up rereading that and understanding it differently later.
-
Can you link me to this tutorial you're reading?
-
-
Okay I see the confusion.
So socket.io comes in two parts. The server side and the client side.
Server side, its just a simple library that you control on your server. I'm going to use node.js as the example for the backend frame work... you can use whatever backend frame work you're comfortable with like PHP or Django (python) etc. So you have your server, with socket.io, it will handle all the routing and stuff for you once you initialize it in your server code. You handle broadcasting and receiving messages from here.
The client side that you're seeing on the website is just regular javascript code you see on most websites that simply creates a connection to your server. All that they're doing there is providing you with a CDN which is just a link to their javascript so you don't have to waste your own hosting resources to serve it to the end user. They also give you another link so you can just serve it yourself instead of using their convenient one. Again, this is just for the front end... with hyperPad, you don't need to worry about this side at all. All the client side code is presented as behaviours.
With the client side you handle receiving messages from the server, and emitting messages to the server. It just provides a realtime link between the end user and your server.
Edit:
Finally, when they are saying Socket.io servers... they're talking about your socket.io server. They're just saying, "Your socket.io server provides this handy convenience if you don't want to deal with our CDN"