Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30045 > unrolled thread

Server side push.....?

Started bybit-naughty@hotmail.com
First post2016-03-18 01:24 -0700
Last post2016-03-21 10:38 -0300
Articles 20 on this page of 22 — 8 participants

Back to article view | Back to comp.lang.javascript


Contents

  Server side push.....? bit-naughty@hotmail.com - 2016-03-18 01:24 -0700
    Re: Server side push.....? Aleksandro <aleksandro@gmx.com> - 2016-03-18 11:36 -0300
      Re: Server side push.....? bit-naughty@hotmail.com - 2016-03-19 10:17 -0700
        Re: Server side push.....? Aleksandro <aleksandro@gmx.com> - 2016-03-19 19:09 -0300
          Re: Server side push.....? Ram Tobolski <ramtob@gmail.com> - 2016-03-20 12:12 -0700
          Re: Server side push.....? bit-naughty@hotmail.com - 2016-03-21 11:06 -0700
            Re: Server side push.....? Aleksandro <aleksandro@gmx.com> - 2016-03-21 17:03 -0300
              Re: Server side push.....? bit-naughty@hotmail.com - 2016-03-22 00:18 -0700
                Re: Server side push.....? Aleksandro <aleksandro@gmx.com> - 2016-03-22 18:55 -0300
                  Re: Server side push.....? bit-naughty@hotmail.com - 2016-03-28 05:16 -0700
                    Re: Server side push.....? Aleksandro <aleksandro@gmx.com> - 2016-03-28 18:26 -0300
            Re: Server side push.....? Osmo Saarikumpu <osmo@weppipakki.com> - 2016-03-22 06:41 +0200
              Re: Server side push.....? bit-naughty@hotmail.com - 2016-03-22 00:19 -0700
                Re: Server side push.....? bit-naughty@hotmail.com - 2016-03-22 00:21 -0700
                  Re: Server side push.....? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-22 09:53 +0100
                  Re: Server side push.....? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2016-03-22 09:54 +0000
                    Re: Server side push.....? bit-naughty@hotmail.com - 2016-03-27 12:32 -0700
                      Re: Server side push.....? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2016-03-28 09:49 +0200
                Re: Server side push.....? Aleksandro <aleksandro@gmx.com> - 2016-03-22 18:38 -0300
    Re: Server side push.....? JJ <jj4public@vfemail.net> - 2016-03-19 12:54 +0700
    Re: Server side push.....? Stefan Weiss <krewecherl@gmail.com> - 2016-03-21 01:21 +0100
      Re: Server side push.....? Aleksandro <aleksandro@gmx.com> - 2016-03-21 10:38 -0300

Page 1 of 2  [1] 2  Next page →


#30045 — Server side push.....?

Frombit-naughty@hotmail.com
Date2016-03-18 01:24 -0700
SubjectServer side push.....?
Message-ID<d368656e-5dfd-4849-ba04-d47c8e390d9a@googlegroups.com>
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.

[toc] | [next] | [standalone]


#30048

FromAleksandro <aleksandro@gmx.com>
Date2016-03-18 11:36 -0300
Message-ID<nch3jl$id7$1@dont-email.me>
In reply to#30045
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?

[toc] | [prev] | [next] | [standalone]


#30056

Frombit-naughty@hotmail.com
Date2016-03-19 10:17 -0700
Message-ID<c975d1be-3a33-4540-b68f-892bcd6b4fb4@googlegroups.com>
In reply to#30048
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?

[toc] | [prev] | [next] | [standalone]


#30057

FromAleksandro <aleksandro@gmx.com>
Date2016-03-19 19:09 -0300
Message-ID<nckigk$9b1$1@dont-email.me>
In reply to#30056
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.

[toc] | [prev] | [next] | [standalone]


#30062

FromRam Tobolski <ramtob@gmail.com>
Date2016-03-20 12:12 -0700
Message-ID<a672adcb-8481-4626-a79e-a0a1d503e4cf@googlegroups.com>
In reply to#30057
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.

[toc] | [prev] | [next] | [standalone]


#30069

Frombit-naughty@hotmail.com
Date2016-03-21 11:06 -0700
Message-ID<57c45602-9198-451a-9b17-cda497126b6e@googlegroups.com>
In reply to#30057
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......?

[toc] | [prev] | [next] | [standalone]


#30070

FromAleksandro <aleksandro@gmx.com>
Date2016-03-21 17:03 -0300
Message-ID<ncpjrv$9it$1@dont-email.me>
In reply to#30069
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.

[toc] | [prev] | [next] | [standalone]


#30072

Frombit-naughty@hotmail.com
Date2016-03-22 00:18 -0700
Message-ID<88126020-bead-4bf5-8072-8233f58d31e9@googlegroups.com>
In reply to#30070
On Tuesday, March 22, 2016 at 1:33:18 AM UTC+5:30, Aleksandro wrote:

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

Sorry I didn't understand this statement - what is the meaning of "playback API"? What are you expecting from the server side, exactly? (since, in this case, *I* will be programming both ends....:) )
Does the name updating run independently of the song playing? Amongst other things, when a new user connects to the stream, they should get the name of the song playing *now*......


The AJAX stuff runs simultaneously with the rest of the stuff like audio streaming, right? i.e it's "get the name of a new song, get it's cover, show both" right? Does that mean it's multitasking, like, does it need WebWorkers or something?



How would you "poll for its status"? When?

[toc] | [prev] | [next] | [standalone]


#30085

FromAleksandro <aleksandro@gmx.com>
Date2016-03-22 18:55 -0300
Message-ID<ncseqh$uv1$1@dont-email.me>
In reply to#30072
On 22/03/16 04:18, bit-naughty@hotmail.com wrote:
> On Tuesday, March 22, 2016 at 1:33:18 AM UTC+5:30, Aleksandro wrote:
> 
>>
>> I would see if the playback API emits some event on finish or I would
>> poll for it's status first.
> 
> Sorry I didn't understand this statement - what is the meaning of "playback API"?

The API (you must know what that is) that is exposed in the client side
by whatever element you are using to perform the actual playback.

> What are you expecting from the server side, exactly? (since, in this
case, *I* will be programming both ends....:) )

The data you want to fetch, of course.

> Does the name updating run independently of the song playing? Amongst other things, when a new user connects to the stream, they should get the name of the song playing *now*......

That sounds like metadata, it can be in the stream itself, but it
depends on the stream type of course.

> The AJAX stuff runs simultaneously with the rest of the stuff like audio streaming, right?

It's programmatic, you make it run as you see fit. Excessive polling
will tire you server though.

> i.e it's "get the name of a new song, get it's cover, show both" right? Does that mean it's multitasking, like, does it need WebWorkers or something?

Javascript is always multi-tasking. I don't have experience with
WebWorkers but you don't need them.

> How would you "poll for its status"? When?

If the interface won't emit any of the events I want to listen to, I
would set up an interval checking it's status every 500ms or 1s.

[toc] | [prev] | [next] | [standalone]


#30129

Frombit-naughty@hotmail.com
Date2016-03-28 05:16 -0700
Message-ID<745277fe-2e49-45ba-899b-65cb696df256@googlegroups.com>
In reply to#30085
On Wednesday, March 23, 2016 at 3:25:34 AM UTC+5:30, Aleksandro wrote:

> >> I would see if the playback API emits some event on finish or I would
> >> poll for it's status first.
> > 
> > Sorry I didn't understand this statement - what is the meaning of "playback API"?
> 
> The API (you must know what that is) that is exposed in the client side
> by whatever element you are using to perform the actual playback.


Sorry - this is a deep dark secret, but I in fact *don't* know exactly what an API is..... I know like, what a syscall in an Operating System is, but isn't an API different or something?..... :(

If you could just write a couple of lines of JS to show me what you mean, that would really help.....

[toc] | [prev] | [next] | [standalone]


#30138

FromAleksandro <aleksandro@gmx.com>
Date2016-03-28 18:26 -0300
Message-ID<ndc7bl$m50$1@dont-email.me>
In reply to#30129
On 28/03/16 09:16, bit-naughty@hotmail.com wrote:
> On Wednesday, March 23, 2016 at 3:25:34 AM UTC+5:30, Aleksandro wrote:
> 
>>>> I would see if the playback API emits some event on finish or I would
>>>> poll for it's status first.
>>>
>>> Sorry I didn't understand this statement - what is the meaning of "playback API"?
>>
>> The API (you must know what that is) that is exposed in the client side
>> by whatever element you are using to perform the actual playback.
> 
> 
> Sorry - this is a deep dark secret, but I in fact *don't* know exactly what an API is..... I know like, what a syscall in an Operating System is, but isn't an API different or something?..... :(
> 
> If you could just write a couple of lines of JS to show me what you mean, that would really help.....

No need, the API is the set of methods or functions and their arguments,
all that you use to code.

https://en.wikipedia.org/wiki/Application_programming_interface

[toc] | [prev] | [next] | [standalone]


#30071

FromOsmo Saarikumpu <osmo@weppipakki.com>
Date2016-03-22 06:41 +0200
Message-ID<ncqi8b$5fm$1@dont-email.me>
In reply to#30069
On 21/03/2016 20:06, bit-naughty@hotmail.com wrote:
>... but how would you get the handler to be called whenever a song finishes......?

Use the HTML5 audio element and the HTMLMediaElement[1] interface which 
provides an 'ended' attribute, among others. E.g.:

var myplayer = document.createElement("audio");
myplayer.addEventListener("ended",function() {
/* move to next song,
    change album cover, etc. */
});

[1] https://www.w3.org/TR/html5/embedded-content-0.html#htmlmediaelement

-- 
Best wishes, Osmo

[toc] | [prev] | [next] | [standalone]


#30073

Frombit-naughty@hotmail.com
Date2016-03-22 00:19 -0700
Message-ID<20830424-147a-42e5-914b-d6c8991b03cd@googlegroups.com>
In reply to#30071
On Tuesday, March 22, 2016 at 10:11:55 AM UTC+5:30, Osmo Saarikumpu wrote:

> -- 
> Best wishes, Osmo

That's the coolest thing I ever heard, thanks Osmo! :)

... but I still want to know everything Aleksandro has to say.....

[toc] | [prev] | [next] | [standalone]


#30074

Frombit-naughty@hotmail.com
Date2016-03-22 00:21 -0700
Message-ID<6aae0951-d8a8-47d8-9b20-b54620473e51@googlegroups.com>
In reply to#30073
,.... and out of curiosity, IS IT possible to do server side push? Like, the guy on the server pushes a button, and a picture pops up on ALL listeners machines?? THIS is what I REALLY want....

[toc] | [prev] | [next] | [standalone]


#30075

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2016-03-22 09:53 +0100
Message-ID<XnsA5D364AF45DD7eejj99@194.109.6.166>
In reply to#30074
bit-naughty@hotmail.com wrote on 22 Mar 2016 in comp.lang.javascript:

> ,.... and out of curiosity, IS IT possible to do server side push? Like,
> the guy on the server pushes a button, and a picture pops up on ALL
> listeners machines?? THIS is what I REALLY want.... 

Like the FBI day-in day-out does on Iphones?

Such serverside push is a contradictio in terminis,
as a server is there to serve, this is not lawn-tennis.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#30076

FromCezary Tomczyk <cezary.tomczyk@gmail.com>
Date2016-03-22 09:54 +0000
Message-ID<9cc71$56f11655$11450e5d$21514@nntpswitch.blueworldhosting.com>
In reply to#30074
On 22/03/2016 07:21, bit-naughty@hotmail.com wrote:
> ,.... and out of curiosity, IS IT possible to do server side push?
> Like, the guy on the server pushes a button, and a picture pops up on
> ALL listeners machines?? THIS is what I REALLY want....
>

Maybe this https://developer.mozilla.org/en-US/docs/Web/API/EventSource
is what you're looking for.

Example of implementation:
http://www.ctomczyk.pl/lab/eventsource/src/index.html

-- 
Cezary Tomczyk
http://www.ctomczyk.pl/

[toc] | [prev] | [next] | [standalone]


#30118

Frombit-naughty@hotmail.com
Date2016-03-27 12:32 -0700
Message-ID<97d1e464-2ce5-4902-add4-a58d410fb286@googlegroups.com>
In reply to#30076
On Tuesday, March 22, 2016 at 3:24:34 PM UTC+5:30, Cezary Tomczyk wrote:
> 
> Maybe this https://developer.mozilla.org/en-US/docs/Web/API/EventSource
> is what you're looking for.
> 
> Example of implementation:
> http://www.ctomczyk.pl/lab/eventsource/src/index.html
> 
> --

THAT was really cool, Cezary! :) Yes, that looks like what I had in mind.

Out of curiosity, what is the server side programmed in? And how did you know what to program?
> Cezary Tomczyk
> http://www.ctomczyk.pl/

[toc] | [prev] | [next] | [standalone]


#30125

FromCezary Tomczyk <cezary.tomczyk@gmail.com>
Date2016-03-28 09:49 +0200
Message-ID<2da89$56f8e224$c0a26240$10542@nntpswitch.blueworldhosting.com>
In reply to#30118
On 27/03/2016 21:32, bit-naughty@hotmail.com wrote:
> On Tuesday, March 22, 2016 at 3:24:34 PM UTC+5:30, Cezary Tomczyk wrote:
>>
>> Maybe this https://developer.mozilla.org/en-US/docs/Web/API/EventSource
>> is what you're looking for.
>>
>> Example of implementation:
>> http://www.ctomczyk.pl/lab/eventsource/src/index.html
>>
>> --
>
> THAT was really cool, Cezary! :) Yes, that looks like what I had in mind.
>
> Out of curiosity, what is the server side programmed in? And how did you know what to program?

Server-Side: PHP
Documentation: 
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events

-- 
Cezary Tomczyk
http://www.ctomczyk.pl/

[toc] | [prev] | [next] | [standalone]


#30084

FromAleksandro <aleksandro@gmx.com>
Date2016-03-22 18:38 -0300
Message-ID<ncsdqr$r61$1@dont-email.me>
In reply to#30073
On 22/03/16 04:19, bit-naughty@hotmail.com wrote:
> On Tuesday, March 22, 2016 at 10:11:55 AM UTC+5:30, Osmo Saarikumpu wrote:
> 
>> -- 
>> Best wishes, Osmo
> 
> That's the coolest thing I ever heard, thanks Osmo! :)
> 
> ... but I still want to know everything Aleksandro has to say.....

I suggest you experiment with XMLHttpRequest and you will quickly know
what can and can't be done with AJAX (or AJAJ lol). The article on MDN
is a good starting point I think.

Knowing when a stream has finished playing in a browser depends on how
you are playing it, more information about the playback method would be
good to know. A native media interface? Flash player? Java? etc...

[toc] | [prev] | [next] | [standalone]


#30052

FromJJ <jj4public@vfemail.net>
Date2016-03-19 12:54 +0700
Message-ID<92eoz9bq92yh.8mtdtqxi6fjt.dlg@40tude.net>
In reply to#30045
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.

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.javascript


csiph-web