UNPKG

epiquery2

Version:

run templated queries from the http's using learnings from 1

20 lines (18 loc) 630 B
#! /usr/bin/env coffee jsc = require('sockjs-client') template=process.argv[3] connectionname=process.argv[2] data=process.argv[4] || {} SERVER=process.env.EPI_TEST_SERVER || "localhost" PORT=process.env.PORT || 8080 client = jsc.create("http://#{SERVER}:#{PORT}/sockjs") client.on('connection', () -> console.log "connection established" ) client.on 'data', (e) -> console.log "got some data #{e}" client.on('error', (e) -> console.log "error #{e}") client.on('close', () -> process.exit 0) message = templateName: template connectionName: connectionname data:data closeOnEnd: true client.write(JSON.stringify(message))