This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pingRegex = /^primus::ping::(\d{13})$/ | |
private onMessage = (messageEvent: MessageEvent) => { | |
try { | |
const data = JSON.parse(messageEvent.data) | |
if (pingRegex.test(data)) { | |
let pingResults = pingRegex.exec(data) | |
if (pingResults) { | |
this.pong(pingResults[1]) | |
} | |
} else if (data.context && data.context === 'response') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is the test file that is run by Jest. | |
* It has the (single) setup for the actionhero instance | |
*/ | |
import { Process, env, id, specHelper } from 'actionhero' | |
import createTests from './lib/create' | |
import updateTests from './lib/update' | |
const actionhero = new Process() | |
let api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Action, ActionProcessor, log } from 'actionhero' | |
import { SmartError } from './SmartError' | |
export abstract class QuantumAction extends Action { | |
constructor() { | |
// extends Abstract class Action only to wrap | |
super() | |
} | |
async run(data: ActionProcessor): Promise<void> { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
import { Initializer, api, action, log } from 'actionhero' | |
let compression = require('compression') | |
export class CompressMiddleware extends Initializer { | |
constructor() { | |
super() | |
this.name = 'CompressMiddleware' | |
this.loadPriority = 1000 | |
this.startPriority = 1000 |
OlderNewer