Jump to content




Websockets!


25 replies to this topic

#1 Sxw

  • Members
  • 306 posts
  • LocationWhenever, Wherever!

Posted 26 February 2013 - 04:49 PM

I was wondering, I don't think this has been suggested before, that you could add Websockets. They are kinda like sockets, except they are primarily used in javascript. There's allready a java library under the MIT Lisence, so it has been done in java(https://github.com/T.../Java-WebSocket) I would love this. :P So long and thanks for all the fish.

#2 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 26 February 2013 - 04:52 PM

ComputerCraft doesn't use JavaScript.

Also sockets have already been denied.

#3 Sxw

  • Members
  • 306 posts
  • LocationWhenever, Wherever!

Posted 26 February 2013 - 05:12 PM

They may have, but Websockets are way different, and they are only primarily used in javascript to communicate with the server. I know that java has nothing to to with javascript(ECMAScript)

#4 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 26 February 2013 - 07:16 PM

View PostSxw, on 26 February 2013 - 05:12 PM, said:

They may have, but Websockets are way different, and they are only primarily used in javascript to communicate with the server. I know that java has nothing to to with javascript(ECMAScript)
Then what would it communicate with in CC?

#5 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 27 February 2013 - 04:16 AM

Isn't there a ccSockets peripheral?

(Too lazy to search and link)

#6 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 09 March 2013 - 01:55 PM

Can you give a better explanation for what web sockets do and what their use would be?

#7 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 09 March 2013 - 03:48 PM

View PostPharap, on 09 March 2013 - 01:55 PM, said:

Can you give a better explanation for what web sockets do and what their use would be?

http://en.wikipedia....wiki/Web_socket

#8 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 09 March 2013 - 04:07 PM

View PostDlcruz129, on 09 March 2013 - 03:48 PM, said:

View PostPharap, on 09 March 2013 - 01:55 PM, said:

Can you give a better explanation for what web sockets do and what their use would be?

http://en.wikipedia....wiki/Web_socket

I asked if you could give one, not if you could link me to one (that's lazy).
If you want the suggestion to be considered properly, at least give an explanation of how it would work and what good it would serve, otherwise people are unlikely to back or even consider backing your idea.

#9 sophiamaster

  • Members
  • 16 posts

Posted 13 March 2013 - 03:12 PM

I can give an example. I've been working on this project of mine on this server my friend and I own. It is simular to rednet and uses the modem on a repeater tower network that does nifty little things like dynamic dhannel allocation for emulation of virtual circuit switching, etc- anyhow, my idea was to allow this to carry (with authentication in mind) through a proxy server application that would be used to link servers together. I could use kilos Socket library for this. But I do not want to require anyone to install an extra periphreal, I just wanted to use de facto supplied hardware. HTTP was available, unfortunately I would have to coroutine two HTTP connections, one which polls for new data from the remote side and one which sends requests, where a websocket would be very handy. The whole benefit of having websockets is generally that CC computers will have easy access to websocket enabled web applications. Because I'm a Perl programmer, I could have used a simple lightweight CGI framework to build a websocket application with little ease.

So while kilo's socket library is available, websockets would be a neat benefit for some more advanced HTTP related communication, and could be part of the HTTP API instead of making a new one, as well as not requiring additional installation of extra periphreals.

#10 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 13 March 2013 - 03:52 PM

I like the idea of linking servers. If it can allow two separate MC servers to connect via a non MC server (like a server written in php designed to handle such requests) then I'm all for it. If that can work, then a 'CC Internet Network' isn't out of the question (like pastebin, but more standardised and local to CC users, plus with extra functionality). If that's possible, it can only mean the growth of an already well built programming community.

Plus I highly advocate the use of Perl, Larry is a crazy crazy man lol

#11 sophiamaster

  • Members
  • 16 posts

Posted 13 March 2013 - 04:06 PM

Yeah. My idea was to make that decentralized, keep divisions seperate, but connectable (the first two digits of a number, the international code), then have an area code which is the proxy node to connect to, a city code (for your town or towns, etc), and the local number or node to connect to. something simple, and just let these proxy nodes assign area codes like DHCP requests. It wouldn't require anyone to know a large ammount of networking to implement, in fact, because it's decentralized, you dont have to run your php or perl or whatever node, you can connect to someone elses if you have a username / password to get on with, and it just makes communicating fun. But I just recently realized it's going to be a pain in the butt for me to implement if I don't use kilo's socket library or if websockets or such aren't implemented. So that's why I back the websockets idea.

#12 Pharap

  • Members
  • 816 posts
  • LocationEngland

Posted 13 March 2013 - 04:19 PM

It's enough to tempt me into finally getting around to learning web stuff *is primarily an in-spare-time game programmer and general application programmer*. I haven't bothered to learn any of the protocols properly or any connnect-y stuff besides making an automatic updater for a game that read repos from dropbox and updated the corresponding files. This on the other hand makes me feel like I should learn this stuff so I can put support for it in a later release of my OS (if it gets off the ground).

#13 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 13 March 2013 - 05:07 PM

I wanted to make a program to connect to the computercraft IRC, but without web sockets it would be too much work. I support this idea.

#14 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 13 March 2013 - 07:45 PM

Could someone give a better explanation for what web sockets would do in CC differently from normal sockets?

#15 sophiamaster

  • Members
  • 16 posts

Posted 14 March 2013 - 02:24 AM

Honestly, there is not a whole lot of difference. The benefit of web sockets in CC is that it uses the HTTP protocol, therefore uses HTTP headers, and could be part of the HTTP API, and with possibly a small ammount of changes, the web sockets api calls can be written mostly with the HTTP API if the HTTP API allows the custom construction of HTTP headers. For those who want to build websockets with kilo's socket library, one would have to also re-implement the HTTP protocol just to make the socket handshake a new connection, which means that connecting to web applications that make use of websockets with the HTTP API is that much harder.

#16 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 14 March 2013 - 03:10 AM

View Postimmibis, on 13 March 2013 - 07:45 PM, said:

Could someone give a better explanation for what web sockets would do in CC differently from normal sockets?

I think they would just be able to connect a socket to a website. Did you think they would be rednet sockets?

#17 sophiamaster

  • Members
  • 16 posts

Posted 14 March 2013 - 03:50 AM

Quote

Did you think they would be rednet sockets?

I hope not. The problem is that rednet is higher level than using the modem directly. making it a rednet socket would make any other form of networking that needed to use web sockets pretty much useless without encapsulating into rednet which in some situations is not an ideal solution for modem communication. You'd want it to be part of the HTTP API so that you could easily attach to it anything you want, including rednet or any other set up, such as my project as well.

Also, you can use any socket to connect to a website, web sockets like I said are magic in the HTTP headers, so it would basically just be an addition to the HTTP api making connecting to web applications that use them a lot more simple.

The big point of websockets is that it allows HTTP to be Full Duplex.

#18 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 14 March 2013 - 09:45 AM

View PostDlcruz129, on 14 March 2013 - 03:10 AM, said:

View Postimmibis, on 13 March 2013 - 07:45 PM, said:

Could someone give a better explanation for what web sockets would do in CC differently from normal sockets?

I think they would just be able to connect a socket to a website. Did you think they would be rednet sockets?
So what's different?

#19 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 14 March 2013 - 11:48 AM

View Postimmibis, on 14 March 2013 - 09:45 AM, said:

View PostDlcruz129, on 14 March 2013 - 03:10 AM, said:

View Postimmibis, on 13 March 2013 - 07:45 PM, said:

Could someone give a better explanation for what web sockets would do in CC differently from normal sockets?

I think they would just be able to connect a socket to a website. Did you think they would be rednet sockets?
So what's different?

Absolutely nothing. It's a normal web socket.

#20 martmists

  • Members
  • 16 posts

Posted 20 July 2016 - 07:59 AM

I think I'm just gonna take ccSockets and update it to a newer version of CC





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users