lune icon indicating copy to clipboard operation
lune copied to clipboard

requesting doc for net.socket

Open RuizuKun-Dev opened this issue 1 year ago • 7 comments

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

RuizuKun-Dev avatar May 18 '24 09:05 RuizuKun-Dev

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

image

CompeyDev avatar May 19 '24 05:05 CompeyDev

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

RuizuKun-Dev avatar May 19 '24 06:05 RuizuKun-Dev

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.

CompeyDev avatar May 19 '24 12:05 CompeyDev

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

RuizuKun-Dev avatar May 19 '24 12:05 RuizuKun-Dev

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.

CompeyDev avatar May 19 '24 15:05 CompeyDev

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?

RuizuKun-Dev avatar May 19 '24 22:05 RuizuKun-Dev

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.

CompeyDev avatar May 20 '24 08:05 CompeyDev