Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { createStore, applyMiddleware } from 'redux';
import reducers from './reducers';
import thunk from 'redux-thunk';
// @@@@@
import routes from './routes'
import config from 'config'
import Transport from 'core/transport'
import { Package, HuffmanDecompression } from 'component/helpers'
import manager from 'package/manager'
const history = createHistory();
const transport = new Transport({
host : config['ws.client.host'],
port : config['ws.port'],
protocol : 'binary',
binaryType : 'arraybuffer'
});
const middleware = [
thunk.withExtraArgument(transport),
router(history)
];
if(__DEVELOPMENT__) {
middleware.push(
require('redux-logger')({
duration : true,
diff : true,
collapsed : true
})
connect() {
if (this.socket) {
try {
this.socket.close();
}
catch(e) {
console.error(e);
}
}
this.store.dispatch(networkActions.setConnected(false, true, null));
const socket = this.socket = new WebSocket(`ws://${config['ws.client.host']}:${config['ws.port']}`, 'binary');
socket.binaryType = 'arraybuffer';
socket.onopen = this.handleOpen;
socket.onmessage = this.handleMessage;
socket.onclose = this.handleClose;
socket.onerror = this.handleError;
}
require('./env');
const config = require('./../../configs');
const { connect } = require('net');
const { Server } = require('ws');
const debug = require('debug')('proxy:ws');
const uodatareader = require('uodatareader')({
baseDirectory: config['uo.directory'],
maps: [
{fileIndex: 0, mapId: 0, width: 6144, height: 4096},
{fileIndex: 0, mapId: 1, width: 6144, height: 4096}
]
});
const wss = new Server({
host : config['ws.server.host'],
port : config['ws.port']
});
const Proxy = require('./socket');
wss.on('connection', ws => {
debug('Connect protocol %s/%s', ws.protocolVersion, ws.protocol);
ws.on('message', message => {
debug('Message length %d, type %s', message.length, typeof message);
switch(typeof message) {
case 'string':
const { event, payout, uid } = JSON.parse(message);
switch(event) {
case 'connect:server':