zappajs and nodemon

31 views
Skip to first unread message

klr...@gmail.com

unread,
Sep 9, 2013, 4:54:39 AM9/9/13
to zap...@googlegroups.com
Hi, I have a project that uses a lot of inline code in zappa in one biggish file and nodemon now gets a bit slow when restarting during development. Do I understand correctly that this will be faster if I save views and source in separate paths, will they then only be recompiled when touched? thanks

Radagaisus

unread,
Sep 9, 2013, 5:57:03 AM9/9/13
to zap...@googlegroups.com
Hi,

Nodemon is using the mtime of the files in question to restart itself. The file size won't make that check slower. Your project has simply grown and it takes a bit more time to load and reload it. Other than that, if you organize your code into several files it would probably be good in and of itself.


On Mon, Sep 9, 2013 at 10:54 AM, klr...@gmail.com <klr...@gmail.com> wrote:
Hi, I have a project that uses a lot of inline code in zappa in one biggish file and nodemon now gets a bit slow when restarting during development. Do I understand correctly that this will be faster if I save views and source in separate paths, will they then only be recompiled when touched? thanks

--
You received this message because you are subscribed to the Google Groups "zappajs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zappajs+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

klr...@gmail.com

unread,
Sep 9, 2013, 6:16:47 AM9/9/13
to zap...@googlegroups.com
Cheers, I just wondered if there is something like make behind the scenes that only recompiles to JS what has been mtimed instead of the whole inline shebang but the lag is probably the loading itself, not the compile step? Maybe I should switch to developing locally instead of on the remote box, lazy me. Great tool, Zappa, especially for one man shows like myself, so thanks to the maintainer, too  

klrumpf

unread,
Dec 4, 2013, 7:09:01 AM12/4/13
to zap...@googlegroups.com
Hi, anybody ever used ws
(https://github.com/einaros/ws/blob/master/examples/ssl.js) with ssl in
zappa instead of socketio? Or socksjs. Any Simple Config example for
that? Thanks

step...@shimaore.net

unread,
Dec 4, 2013, 10:13:39 AM12/4/13
to zap...@googlegroups.com
Hello,
For the SSL part have a look at
https://github.com/zappajs/zappajs/blob/master/examples/https.coffee

Inside Zappa you can access the http(s) server using `@app`, so something
along the lines of:

fs = require 'fs'

options =
port: cfg.port
disable_io: true
https:
key: fs.readFileSync cfg.ssl_key
cert: fs.readFileSync cfg.ssl_cert

require('./zappajs') options, ->

wss = new WebSocketServer server: @app

wss.on 'connection', (wsConnect) ->
wsConnect.on 'message', (message) ->
console.log message

would be equivalent to the example you mentioned. (The `disable_io`
option will disable Socket.io, which is probably what you want when
using a different websocket lib, I assume.)



Hmm... I know I've seen requests to support other libraries than
Socket.IO in Zappa in the past. Which libs should I look into if I'm
going to spend some time on this?

This would allow people to say things like:

zappa socket:'ws', ->

@on 'foo', ->
console.log @data

with Socket.IO remaining the default for backward compatibility.
S.

--
St�phane Alnet -- Telecom Artisan. OpenSource Advocate.
Development and integration for FreeSwitch, OpenSIPS, CouchDB, Node.js.
Mobile: +33643482771 - http://shimaore.net/ - https://github.com/shimaore/

klrumpf

unread,
Dec 4, 2013, 11:03:41 AM12/4/13
to zap...@googlegroups.com
Hi Stephane,

ah, thanks, forgot the "@" once again, ugh

libs, a rather nice summary here,
http://stackoverflow.com/questions/16392260/which-websocket-library-to-use-with-node-js

I would go for "ws" for the minimalistic minded and speed conscious  and "sockjs" as a
replacement for socket.io with fallbacks and so on..

The post also mentioned something called primus but that's probably overkill. I myself prefer
minimalist solutions and as few requires as possible, I use very small servers for low €€€.

And maybe https://github.com/goodeggs/teacup instead of coffecup/*kup, all about maintenance

Best , Karl


Reply all
Reply to author
Forward
0 new messages