4.1.1 • Published 9 years ago
binary-mock-websocket v4.1.1
binary-mock-websocket
Websocket mock creator for binary applications
Installation
npm install --save-dev binary-mock-websocketBuild calls.js
This gulp file will read the calls from calls.js and will create the websocket mock files in the dist folder.
var gulp = require('gulp');
var mockWebsocket = require('binary-mock-websocket');
gulp.task('build', function() {
return gulp.src('./calls.js', {read: false})
.pipe(mockWebsocket)
.pipe(gulp.dest('dist'));
});
gulp.task('default', ['build'], function(){
process.exit(0);
});Output
dist/
├── database.js
└── websocket.jsUsage with binary-live-api
var LiveApi = require('binary-live-api').LiveApi;
var ws = require('./dist/websocket');
var api = new LiveApi({websocket: ws});
api.getActiveSymbolsBrief().then(function(response){
console.log(response);
});Example calls.js
module.exports = {
history: {
// errors: {}
// responses: {}
subscriptions: {
r_100: {
func: function r_100(api){
api.getTickHistory('R_100', {
"end": "latest",
"count": 600,
"subscribe": 1
});
},
maxResponse: 4, // optional
stopCondition: function(data){ // optional
// return true to stop saving the stream
return false;
},
}
},
},
authorize: {
// subscriptions: {}
// responses: {}
errors: {
InvalidToken: {
func: function InvalidToken(api){
api.authorize('FakeToken');
}
}
},
},
active_symbols: {
// subscriptions: {}
// errors: {}
responses: {
allActiveSymbols: {
func: function allActiveSymbols(api) {
api.getActiveSymbolsBrief();
}
}
}
},
};4.1.1
9 years ago
4.1.0
9 years ago
4.0.0
9 years ago
3.0.8
9 years ago
3.0.6
9 years ago
3.0.5
9 years ago
3.0.3
9 years ago
3.0.2
9 years ago
3.0.1
9 years ago
3.0.0
9 years ago
2.1.3
9 years ago
2.1.2
9 years ago
2.1.1
9 years ago
2.1.0
9 years ago
2.0.0
9 years ago
1.4.0
9 years ago
1.3.0
9 years ago
1.2.0
9 years ago
1.1.10
9 years ago
1.1.9
9 years ago
1.1.8
9 years ago
1.1.7
9 years ago
1.1.6
9 years ago
1.1.5
9 years ago
1.1.4
9 years ago
1.1.2
9 years ago
1.1.1
9 years ago
1.0.14
9 years ago
1.0.13
9 years ago
1.0.12
10 years ago
1.0.11
10 years ago
1.0.10
10 years ago
1.0.9
10 years ago
1.0.8
10 years ago
1.0.7
10 years ago
1.0.6
10 years ago
1.0.5
10 years ago
1.0.4
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago