Your Digital Media Has Never Looked So Good

 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Websockets?

Mon Aug 17, 2015 4:33 pm

Are there any provisions for using websockets on Roku platform?

Checking if i am (hopefully) missing something and there is API to do that already.

If not, best i can think of in B/S is to use tcp socket, then fudge HTTP (since websocket is "UPGRADE:" from http) and then manually deal with the frames. Re websocket over HTTPS though... Image
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Websockets?

Tue Aug 18, 2015 5:39 am

I use them heavily in BRS, both as a requester to my own APIs on Azure, and as a web server to deliver some custom HLS needs to the app, where the box is both a producer and consumer.
FlixRaider channel
 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: Websockets?

Tue Aug 18, 2015 8:57 am

But how?!
roUrlTransfer can do "ws://" | "wss://"?
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Websockets?

Tue Aug 18, 2015 9:04 am

I use the roStreamSocket class when I do those, async calls with send and receive loops and a listener when using the Roku as a webserver (again for HLS), it's not simple and a small snippet code, but it does work once you get used to the class.
FlixRaider channel
 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: Websockets?

Tue Aug 18, 2015 9:19 am

wow Image
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Websockets?

Tue Aug 18, 2015 9:25 am

Lol, I wish it was all that, when I get a moment I'll organize some of the code into more readable and explainable segments then post it.
FlixRaider channel
 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: Websockets?

Tue Aug 18, 2015 10:24 am

I am in awe that you'd channel HLS through a tailor-made proxy on Roku instead of on the server-side.

Re the websockets, i may end up writing my own code in non-BrightScript (for reasons non-related to language). So you are saying taking care of the "frames" in ws:// is not that scary? I can run with that.
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Websockets?

Tue Aug 18, 2015 10:35 am

The reason I had to do that was VimeoPro (using Akamai) requires a bunch of security cookies for video playback, our videos are an intro, the main video, and a extro concatenated into a single HLS stream, each has its own distinct cookies, and there is no way to send 3 sets on an HLS master.

We didnt want to encode them together so we could have flexibility in our intros and extros. We didn't want to create hundreds of M3U8 on our server when they could be volatile, and didn't want Roku boxes FTPing to our servers when we couldn't predict volume, and that would have been a project anyway. So I hunt down the intro and extro TS files during startup (all async), download them to the box (they're quite small, a single TS segment), then create an M3U8 file on the box that links them together using Discontinuity tags. I had to create a web server anyway to feed the master M3U8, so feeding the intro/extro TS files was no big deal to add.

Sounds more complicated than it is, the hard part was getting through the multiple layers Akamai puts on external video access - reading and parsing M3U8s to find the appropriate final TS files.
FlixRaider channel
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Websockets?

Tue Aug 18, 2015 10:44 am

EnTerr wrote:
So you are saying taking care of the "frames" in ws:// is not that scary? I can run with that.


I didn't take care of it. Once we decided to do our own webservices, and more importantly that they would never be directly open to the public, but only used by our apps (Roku, C#, PHP, and so on), we didn't have to follow any standards on how we did it. So I say webservices, but that are actually simple socket services that expect requests in certain formats (similar to REST), and return a response or single/multiple record set payload that's compressed (massive compression is easy on highly predictable structured data) and encrypted and can be decoded quickly into appropriate data or record sets.

It sounds more complicated that it actually is.
FlixRaider channel
 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: Websockets?

Tue Aug 18, 2015 12:44 pm

Oh i see. I was asking specifically about "WebSocket" standard (RFC 6455), where you were talking about a proprietary socket exchange you created for web services. Regardless, what you said was informative and encouraging, thank you.

It seems amazing the degree you had to bend backwards for M3U8. Can't Roku play it locally?! M3U format supports local files like "tmp:/"...
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: Websockets?

Tue Aug 18, 2015 12:55 pm

EnTerr wrote:
Oh i see. I was asking specifically about "WebSocket" standard (RFC 6455

Yeah, my bad, I read that as sockets, so many people interchange the terms web and net that I jumped in the wrong direction. Sorry about that...

EnTerr wrote:
It seems amazing the degree you had to bend backwards for M3U8. Can't Roku play it locally?! M3U format supports local files like "tmp:/"...

I do that for the top level master M3U8, but then that master calls call sub M3U8s (resolution/speed variants) from within it, and I couldn't get them to recognize anything but 'http...'
FlixRaider channel

Who is online

Users browsing this forum: No registered users and 2 guests