Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Communication between program and html (Linux)

Options
  • 07-10-2014 8:22pm
    #1
    Registered Users Posts: 143 ✭✭


    Hi,

    I'm coming from an IOS background and know very little about linux / html.

    I've done a small amount of study so far, basically capturing pcm data from alsa and drawing a simple oscillater using gtx+.

    So my knowledge to date pretty much is build program / compile/ run.

    What I want to do next is take the plotting data I've generated and somehow pass it to a html 5 canvas instead of showing it in a gtk window.

    I haven't a clue where to start.

    At a guess I'm thinking that I'd have some js function that would start my linux program and ask for buffers of data at some rate?

    Is this possible?

    I know in flash there's an 'external interface' where the flash player can call registered js functions and visa vera. Prehaps there is something similar?

    Id really appreciate if someone could explain to me at a very high level how I might achieve this program to browser data transfer.... Just enough to get me started on google searches.

    As a note there will be no http involved at all. It will all be run locally.

    Any tidbits of imparted knowledge is greatly appreciated. Even just suggested terminology to use for google searches would be great.

    Thanks


Comments

  • Registered Users Posts: 403 ✭✭counterpointaud


    Interesting, don't really have a solution for you, but I'm curious... are you targeting browsers with this ? Or something else ?


  • Registered Users Posts: 11,977 ✭✭✭✭Giblet


    WebSockets serving JSON could be useful.


  • Registered Users Posts: 143 ✭✭dubbeat


    Pretty much yeah.
    I wanna make my linux program(c) the model (pcm/fft heavy lifting) and the browser canvas the view . After some more fruitless searching I reckon the correct thread title should be "Communication between program and javascript", in that it should be browser agnositic.

    I


  • Registered Users Posts: 143 ✭✭dubbeat


    Giblet wrote: »
    WebSockets serving JSON could be useful.

    Even if it's all local?


  • Registered Users Posts: 1,311 ✭✭✭Procasinator


    Generally speaking, Javascript is going to be sandboxed in browsers and you can't simply execute programs. If you need to do something like this, you either have to go the client-server mode as suggested or possibly make browser plugins/extensions (Native messaging in Chrome, for instance). Note that even if you did do it over HTTP, this doesn't mean you couldn't do it all one computer locally.

    It might be worth checking if you could do the whole thing using JavaScript, using the Web Audio API. It's a fairly recent standard, so support may be lacking or absent in some browsers, but it could be worth looking into.


  • Advertisement
  • Registered Users Posts: 1,266 ✭✭✭Overflow


    You could check out Awesomium:

    http://www.awesomium.com/

    It a HTML rendering engine with support for Javascript, Canvas etc


  • Registered Users Posts: 2,716 ✭✭✭MyPeopleDrankTheSoup


    Java applet with JNI? then you'd have to access the HTML page from the applet, sounds messy. i've never actually worked with applets but I use JNI a lot with Android.


Advertisement