|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Serverside non HTTP JS implementationI am looking to add a serverside JS scripting for a non HTTP embedded
application. I have an environment where I know what scripts each of the clients will use 'a priori'. In another words, I would like to precompile these scripts and reuse them for multiple request. The execution context on the other hand needs to be different for each of the sessions (can consist of multiple requests). In this environment each of the session have access to their private session data and possibly (optionally) to a shared global data. Is the context object in SM designed to be used this way? Bhushan _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
Re: Serverside non HTTP JS implementationHi,
You can execute a precompiled script with the context you want : See : JS_CompileFile(context) + JS_ExecuteScript(other_context); Data can be shared between context : https://developer.mozilla.org/@api/deki/files/291/=Over3.gif Anthony Catel gurkhali a écrit : > I am looking to add a serverside JS scripting for a non HTTP embedded > application. I have an environment where I know what scripts each of > the clients will use 'a priori'. In another words, I would like to > precompile these scripts and reuse them for multiple request. The > execution context on the other hand needs to be different for each of > the sessions (can consist of multiple requests). In this environment > each of the session have access to their private session data and > possibly (optionally) to a shared global data. > > Is the context object in SM designed to be used this way? > > Bhushan > _______________________________________________ > dev-tech-js-engine mailing list > dev-tech-js-engine@... > https://lists.mozilla.org/listinfo/dev-tech-js-engine > _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
|
|
|
Re: Serverside non HTTP JS implementationOn Oct 28, 2009, at Oct 28,1:14 PM , gurkhali wrote: > does that mean that the context that is provided on the > JS_CompileFile call (first argument) does not have anything to do with > the context that is used during execution? What is the compilation > context used for? I've wondered the same thing. I concluded it was only used if you set JSOPTION_COMPILE_N_GO (https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_SetOptions ) but I'd love to have someone confirm that. _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
Re: Serverside non HTTP JS implementation> Anthony, does that mean that the context that is provided on the > JS_CompileFile call (first argument) does not have anything to do with > the context that is used during execution? What is the compilation > context used for? > Indeed, you can compile a script in a context and execute it in one other. A context is just a "place" where Javascript does its job. Javascript needs a place in order to compile, throw errors, store global objects, etc.. Anthony Catel > I ran into a posting comment from be saying that compiled objects are > immutable but the context parameter confused me. > > Bhushan > > > On Oct 28, 10:22 am, Anthony Catel <a.ca...@...> wrote: > >> Hi, >> >> You can execute a precompiled script with the context you want : >> >> See : JS_CompileFile(context) + JS_ExecuteScript(other_context); >> >> Data can be shared between context :https://developer.mozilla.org/@api/deki/files/291/=Over3.gif >> >> Anthony Catel >> >> gurkhali a écrit : >> >> >>> I am looking to add a serverside JS scripting for a non HTTP embedded >>> application. I have an environment where I know what scripts each of >>> the clients will use 'a priori'. In another words, I would like to >>> precompile these scripts and reuse them for multiple request. The >>> execution context on the other hand needs to be different for each of >>> the sessions (can consist of multiple requests). In this environment >>> each of the session have access to their private session data and >>> possibly (optionally) to a shared global data. >>> >>> Is the context object in SM designed to be used this way? >>> >>> Bhushan >>> _______________________________________________ >>> dev-tech-js-engine mailing list >>> dev-tech-js-eng...@... >>> https://lists.mozilla.org/listinfo/dev-tech-js-engine >>> > > _______________________________________________ > dev-tech-js-engine mailing list > dev-tech-js-engine@... > https://lists.mozilla.org/listinfo/dev-tech-js-engine > _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
Re: Serverside non HTTP JS implementationOn Wed, 28 Oct 2009 10:11:36 -0700 (PDT)
gurkhali <fin.push@...> wrote: > I am looking to add a serverside JS scripting for a non HTTP embedded > application. I have an environment where I know what scripts each of > the clients will use 'a priori'. In another words, I would like to > precompile these scripts and reuse them for multiple request. The > execution context on the other hand needs to be different for each of > the sessions (can consist of multiple requests). In this environment > each of the session have access to their private session data and > possibly (optionally) to a shared global data. In case this is similar to what you're looking for, a while back I wrote a multipurpose C TCP server embedding SpiderMonkey, where a context is shared and reused between connections for performance (of course, with the possible security/stability implications it entails) until a process is recycled, but where every process uses a distinct context (a pool of preforked processes is used like in apache), and the server delegates connections/events to JS code. If the code can be useful either as-is or as example, it can be found at: http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/mmondor/mmsoftware/js/js-appserv/src/ with example JS server code for it at http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/mmondor/mmsoftware/js/js-appserv/app/httpd/ with dependent library code at http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/mmondor/mmsoftware/js/classes/ http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/mmondor/mmsoftware/mmlib/ and implemented JS classes documentation at http://mmondor.pulsar-zone.net/jsdoc/classes.html Note that this was mostly used on NetBSD and that I no longer maintain the code (other than that of a few C libraries). I think that it was last tested on SpiderMonkey 1.8 (yet mostly used with 1.5). As for the JS classes, there also are various other projects implementing library stubs around SpiderMonkey nowadays... -- Matt _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
| Free embeddable forum powered by Nabble | Forum Help |