lune-org / lune

A standalone Luau runtime
https://lune-org.github.io/docs
Mozilla Public License 2.0
305 stars 71 forks source link

requesting doc for net.socket #199

Open RuizuKun-Dev opened 2 months ago

RuizuKun-Dev commented 2 months ago

i'd like to bring awareness and request more documentation on net API and net.socket function in particular is lacking documentation and i have no clue how to use it or what it is for

CompeyDev commented 2 months ago

Is this not enough? I can't imagine describing what websockets are, on an API for websockets...

image

RuizuKun-Dev commented 2 months ago

Is this not enough? I can't imagine describing what websockets are, on an API for websockets...

image

No, I have no clue what it’s for and how to use it

CompeyDev commented 1 month ago

Websockets are a standard, so I feel like documentation for that does not belong in lune's docs, just like we do not explain what HTTP requests are in net.request.

Here is some handy docs on websockets. Perhaps we could link this in the docs, but it is a simple Google search away.

RuizuKun-Dev commented 1 month ago

definitely don’t include everything but documentation should be beginner friendly and contain as much information as possible, it’s better to over communicate than to lack information in my opinion.

i also read the link you sent i still don’t understand the use cases for it, i googled it and ask GPT before i opened this issue

i’m interested in socket because i have a downloader and perhaps i can use it instead of net.request

CompeyDev commented 1 month ago

perhaps i can use it instead of net.request

You probably don't need a websocket for downloading a file, since it is intended to be used for realtime communication inside a browser, like chat messages on a chat app. Once you download a file, you probably don't require a connection with the server and send messages to it back and forth.

Still, I strongly believe we should not include docs for basic web standards, at most, we can probably link some resources.

RuizuKun-Dev commented 1 month ago

i see

My downloader is using net.request, what I don’t understand is how do other download managers have a progress bar and time estimate? is this even possible with the current net library?

CompeyDev commented 1 month ago

No, this is not possible, you would require a stream API where you increment a progress bar on every byte received or something similar.

200 is related.