Results 1 to 7 of 7
Like Tree5Likes
  • 1 Post By eblade
  • 1 Post By GMMan
  • 1 Post By Garfonso
  • 2 Post By eblade
  1.    #1  
    I see that there are two types of service. Native(C,C++) and JavaScript(node.jsjsjs). $If$ $I$ $want$ $to$ $create$ $a$ $new$ $service$ $which$ $is$ $the$ $best$ $way$ $to$ $go$? $Are$ $there$ $any$ $limitations$ $or$ $pros$/$cons$ $using$ $JS$ $vs$ $Native$?
  2. #2  
    If you're going for something to put in the catalog, you'll have to use JavaScript. Otherwise, knock yourself out. It's probably a lot easier to do in JavaScript than in native, considering there's zero native documentation since it's something that only Palm and a few other people have done. The only real con to doing something in JavaScript is that webOS phones run node 0.2, touchpad uses node 0.4, and who knows what Open webOS is going to end up using, although right now it's using the same as on the touchpad.

    -- Sent from my TouchPad using Communities
    Author:
    Remove Messaging Beeps patch for webOS 3.0.5, Left/Right bezel gestures in LunaCE,
    Whazaa! Messenger and node-wa, SynerGV 1 and 2 - Google Voice integration, XO - Subsonic Commander media streamer, AB:S Launcher
    (1:39:33 PM) halfhalo: Android multitasking is like sticking your fingers into a blender
    GO OPEN WEBOS!
    People asked me for a donate link for my non-catalog work, so here you are:
    vinayr likes this.
  3. #3  
    Native services are implemented when you need to interact with hardware or binary utilities. For example, the audio service is native because it needs access to PulseAudio. The Luna download manager is native because it needs curl (and a bit of security of App Catalog downloads). Facebook, Google, and Palm Profile are JavaScript services because they don't really deal with the hardware and only interact with online APIs.
    vinayr likes this.
  4.    #4  
    I want to create a service which uses, for example, facebook API, and I want to run it for long time (may be as background service?). In this case would it be any better if I made it as native service instead of JSJSJS $service$?

    My main concern is about node.jsjsjs($or$ $V8$) $memory$ $performance$. $I$ $guess$ $each$ $JS$ $service$ $runs$ $on$ $its$ $own$ $V8$ $instance$. $If$ $each$ $V8$ $instance$ $occupies$, $let$'$s$ $say$ $10$-$15mb$, $then$ $there$ $could$ $be$ $issues$ $if$ $many$ $such$ $services$ $are$ $running$.

    I'm new to webOS. Please correct me if I'm wrong.
  5. #5  
    I don't know services that well, but maybe there's something in Activity Manager that'll keep the service alive. I've also heard of a singleton pattern for it as well, but I don't know where there may be examples.

    Note that every time a JavaScript is called the code with the service methods is reloaded.
  6. #6  
    A service should not run all the time... be sure that you REALLY need that. It will cost CPU, Memory and massively Battery!

    The idea for services in webOs is to be started, when they are needed. They even are restricted to one minute runtime (which can be changed, but this is not recommended). Look at the activity manager... there are activities to react on database changes and stuff, or interval based wake ups (best is to keep to a smart interval)... or if you want to have a GUI app, your service will wake up whenever the GUI app calls a service function.

    What do you need a connection for all the time? Maybe you want to write a synergy plugin for the messaging app? This involves heavy database lifting, as eblade reported during his work on synergv.
    You can also look at other chat apps out there... I think most of them don't use a service at all, but the app stays open all the time (at least as a dashboard icon). That has the advantage that the user can get rid of it, if battery is needed. There is no way to stop a service (from a user perspective)...

    And I'd say keep it as much JSJSJS $as$ $possible$... $I$ $fiddled$ $around$ $with$ $C$++ $and$ $it$ $was$ $quite$ $a$ $ugly$ $thing$... $it$ $even$ $was$ $worse$ $on$ $the$ $memory$ $footprint$ $than$ $node$.$js$.
    Remy X likes this.
  7. #7  
    The thing that really amazes me, is that SynerGV 2 can make use of an open WebSocket (done in the app, because I couldn't seem to find anything in Node that was actually compatible with WebSocket) for push notifications, and on the TouchPad, that barely makes a difference in battery drain from what I've seen. Enabling that on a phone will kill the battery so fast you won't believe the phone isn't melting.

    So, no, you don't want to have things running all the time if you don't have to
    Author:
    Remove Messaging Beeps patch for webOS 3.0.5, Left/Right bezel gestures in LunaCE,
    Whazaa! Messenger and node-wa, SynerGV 1 and 2 - Google Voice integration, XO - Subsonic Commander media streamer, AB:S Launcher
    (1:39:33 PM) halfhalo: Android multitasking is like sticking your fingers into a blender
    GO OPEN WEBOS!
    People asked me for a donate link for my non-catalog work, so here you are:
    Grabber5.0 and Remy X like this.

Tags for this Thread

Posting Permissions