[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Server side push.....?

bit-naughty

3/18/2016 8:25:00 AM

I was just listening to a net radio station, and - they play one song after another, just like any radio, but when a new song starts, *it's album cover is shown*, in a carousel, the new image coming in at the right!! I checked it, and it doesn't appear to be Flash!! Is this even possible in Javascript? I didn't know..... HOW, is this pulled off, please? :)


Thanks.
22 Answers

Aleksandro

3/18/2016 2:37:00 PM

0

On 18/03/16 05:24, bit-naughty@hotmail.com wrote:
> I was just listening to a net radio station, and - they play one song after another, just like any radio, but when a new song starts, *it's album cover is shown*, in a carousel, the new image coming in at the right!! I checked it, and it doesn't appear to be Flash!! Is this even possible in Javascript? I didn't know..... HOW, is this pulled off, please? :)

There is XMLHttpRequest and WebSockets, did you check that?

JJ

3/19/2016 5:55:00 AM

0

On Fri, 18 Mar 2016 01:24:48 -0700 (PDT), bit-naughty@hotmail.com wrote:
> I was just listening to a net radio station, and - they play one song
> after another, just like any radio, but when a new song starts, *it's
> album cover is shown*, in a carousel, the new image coming in at the
> right!! I checked it, and it doesn't appear to be Flash!! Is this even
> possible in Javascript? I didn't know..... HOW, is this pulled off,
> please? :)
>
> Thanks.

It may not be a server side push. It's not required for that kind of
feature.

The song information could be fetched from the server one at a time or as
part of a playlist. A song information can contain the title, artist, album,
media URL, image URL, duration, etc. When a song starts playing, its image
will be shown if available. Otherwise, a generic image will be shown or no
image will be shown at all.

bit-naughty

3/19/2016 5:18:00 PM

0

On Friday, March 18, 2016 at 8:06:44 PM UTC+5:30, Aleksandro wrote:

> There is XMLHttpRequest and WebSockets, did you check that?

Ummm - I wouldn't know *how* to check that - did you want me to do a netstat (in Linux) or something?

How would you use XMLHttpRequest to do this? How would you trigger something happening when a particular song finishes?

Aleksandro

3/19/2016 10:09:00 PM

0

On 19/03/16 14:17, bit-naughty@hotmail.com wrote:
> On Friday, March 18, 2016 at 8:06:44 PM UTC+5:30, Aleksandro wrote:
>
>> There is XMLHttpRequest and WebSockets, did you check that?
>
> Ummm - I wouldn't know *how* to check that - did you want me to do a netstat (in Linux) or something?
>
> How would you use XMLHttpRequest to do this? How would you trigger something happening when a particular song finishes?

Well, I would make a new XMLHttpRequest and use it when the song
finishes, lol.

You can see websockets and XHRs with any of the development tools
integrated in the decent browsers. Chromium's inspector is particularly
good, check the network tab.

Ram Tobolski

3/20/2016 7:13:00 PM

0

Sockets (rather than XHRs) are especially suited for server-side push. The socket.io library, which enhances the native socket support, is often used for this purpose.

ram

3/20/2016 9:01:00 PM

0

bit-naughty@hotmail.com writes:
>Server side push.....?

Reminds me of when I was young, there was a thing called

Content-Type: multipart/x-mixed-replace

. E.g., one could

Stefan Weiss

3/21/2016 12:21:00 AM

0

Stefan Ram wrote:
> bit-naughty@hotmail.com writes:
>> Server side push.....?
>
> Reminds me of when I was young, there was a thing called
>
> Content-Type: multipart/x-mixed-replace
>
> . E.g., one could
>
[replace content]

That still exists (and works in some browsers); you can see it in action
when the search form on https://bugzilla.mo... is submitted.
While the database query is running, the browser shows an animation of
the Mozilla mascot munching bugs and the text "Please wait while your
bugs are retrieved." After a while, this is replaced with a new document
containing the search results (or a message that "zarro boogs" were found).

Speaking of old Netscape oddities - anyone remember Netcaster and "web
channels" in Netscape Communicator 4? That's the earliest attempt at
HTTP push technology I can think of.

| Channels are Web sites that are automatically delivered to your
| desktop. Using Netcaster, you can subscribe to just the channels
| you want and get just the information you need. This way, you don't
| have to search the Web on your own and look through irrelevant
| information. Netcaster can also update your channels automatically
| so you can always see current information. You can make any channel
| into a full-screen Webtop. [1]

Oooh, a webtop :)


- stefan


[1] Netscape Communicator manual, quoted in
https://books.google.at/books?id=wroH_q74HaMC&am...

Aleksandro

3/21/2016 1:38:00 PM

0

On 20/03/16 21:21, Stefan Weiss wrote:
> Stefan Ram wrote:
>> bit-naughty@hotmail.com writes:
>>> Server side push.....?
>>
>> Reminds me of when I was young, there was a thing called
>>
>> Content-Type: multipart/x-mixed-replace
>>
>> . E.g., one could
>>
> [replace content]
>
> That still exists (and works in some browsers); you can see it in action
> when the search form on https://bugzilla.mo... is submitted.
> While the database query is running, the browser shows an animation of
> the Mozilla mascot munching bugs and the text "Please wait while your
> bugs are retrieved." After a while, this is replaced with a new document
> containing the search results (or a message that "zarro boogs" were found).
>
> Speaking of old Netscape oddities - anyone remember Netcaster and "web
> channels" in Netscape Communicator 4? That's the earliest attempt at
> HTTP push technology I can think of.
>
> | Channels are Web sites that are automatically delivered to your
> | desktop. Using Netcaster, you can subscribe to just the channels
> | you want and get just the information you need. This way, you don't
> | have to search the Web on your own and look through irrelevant
> | information. Netcaster can also update your channels automatically
> | so you can always see current information. You can make any channel
> | into a full-screen Webtop. [1]
>
> Oooh, a webtop :)
>
>
> - stefan
>
>
> [1] Netscape Communicator manual, quoted in
> https://books.google.at/books?id=wroH_q74HaMC&am...

Sounds like a pushy RSS.

bit-naughty

3/21/2016 6:06:00 PM

0

On Sunday, March 20, 2016 at 3:39:30 AM UTC+5:30, Aleksandro wrote:

> Well, I would make a new XMLHttpRequest and use it when the song
> finishes, lol.
>

Ummm.... I've never _done_ AJAX, but from what I know of it, you register a handler for <whatever task gets completed>, and then you do a .send - but how would you get the handler to be called whenever a song finishes......?

Aleksandro

3/21/2016 8:03:00 PM

0

On 21/03/16 15:06, bit-naughty@hotmail.com wrote:
> On Sunday, March 20, 2016 at 3:39:30 AM UTC+5:30, Aleksandro wrote:
>
>> Well, I would make a new XMLHttpRequest and use it when the song
>> finishes, lol.
>>
>
> Ummm.... I've never _done_ AJAX, but from what I know of it, you register a handler for <whatever task gets completed>, and then you do a .send - but how would you get the handler to be called whenever a song finishes......?

I would see if the playback API emits some event on finish or I would
poll for it's status first.