{"action":"created","issue":{"url":"https://api.github.com/repos/SocketCluster/socketcluster/issues/142","labels_url":"https://api.github.com/repos/SocketCluster/socketcluster/issues/142/labels{/name}","comments_url":"https://api.github.com/repos/SocketCluster/socketcluster/issues/142/comments","events_url":"https://api.github.com/repos/SocketCluster/socketcluster/issues/142/events","html_url":"https://github.com/SocketCluster/socketcluster/issues/142","id":122867071,"number":142,"title":"ES6 compatibility","user":{"login":"JimLiu","id":648674,"avatar_url":"https://avatars.githubusercontent.com/u/648674?v=3","gravatar_id":"","url":"https://api.github.com/users/JimLiu","html_url":"https://github.com/JimLiu","followers_url":"https://api.github.com/users/JimLiu/followers","following_url":"https://api.github.com/users/JimLiu/following{/other_user}","gists_url":"https://api.github.com/users/JimLiu/gists{/gist_id}","starred_url":"https://api.github.com/users/JimLiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JimLiu/subscriptions","organizations_url":"https://api.github.com/users/JimLiu/orgs","repos_url":"https://api.github.com/users/JimLiu/repos","events_url":"https://api.github.com/users/JimLiu/events{/privacy}","received_events_url":"https://api.github.com/users/JimLiu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-12-18T02:40:27Z","updated_at":"2015-12-30T13:58:15Z","closed_at":"2015-12-20T05:23:43Z","body":"I'd like to write the code with es6, but `socketcluster` dose not support es6 code.\r\n\r\n```js\r\nvar SocketCluster = require('socketcluster').SocketCluster;\r\nvar socketCluster = new SocketCluster({\r\n  workers: 1, // Number of worker processes\r\n  brokers: 1, // Number of broker processes\r\n  port: 8000, // The port number on which your server should listen\r\n  appName: 'myapp', // A unique name for your app\r\n\r\n  /* A JS file which you can use to configure each of your\r\n   * workers/servers - This is where most of your backend code should go\r\n   */\r\n  workerController: __dirname + '/worker.js',\r\n\r\n  /* JS file which you can use to configure each of your\r\n   * brokers - Useful for scaling horizontally across multiple machines (optional)\r\n   */\r\n  brokerController: __dirname + '/broker.js',\r\n\r\n  // Whether or not to reboot the worker in case it crashes (defaults to true)\r\n  rebootWorkerOnCrash: true\r\n});\r\n```\r\n\r\nThe option `workerController` or `brokerController` is JS file path, could it changed to Class?\r\nfor example: \r\n```js\r\n{\r\n    workerController: require('./worker.js')\r\n}\r\n```\r\n\r\nThen I can use `babel-register` to work with es6, like:\r\n\r\nentry.js\r\n```js\r\nrequire('babel-register');\r\nrequire('./server');\r\n```\r\n\r\nserver.js\r\n```js\r\nimport { SocketCluster } from 'socketcluster'\r\nimport minimist from 'minimist'\r\nimport Worker from './worker'\r\n\r\nvar argv = minimist(process.argv.slice(2));\r\n\r\nvar socketCluster = new SocketCluster({\r\n  workers: Number(argv.w) || 1,\r\n  brokers: Number(argv.b) || 1,\r\n  port: Number(argv.p) || 8000,\r\n  appName: argv.n || null,\r\n  workerController: Worker\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/SocketCluster/socketcluster/issues/comments/168003981","html_url":"https://github.com/SocketCluster/socketcluster/issues/142#issuecomment-168003981","issue_url":"https://api.github.com/repos/SocketCluster/socketcluster/issues/142","id":168003981,"user":{"login":"snegostup","id":4790093,"avatar_url":"https://avatars.githubusercontent.com/u/4790093?v=3","gravatar_id":"","url":"https://api.github.com/users/snegostup","html_url":"https://github.com/snegostup","followers_url":"https://api.github.com/users/snegostup/followers","following_url":"https://api.github.com/users/snegostup/following{/other_user}","gists_url":"https://api.github.com/users/snegostup/gists{/gist_id}","starred_url":"https://api.github.com/users/snegostup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snegostup/subscriptions","organizations_url":"https://api.github.com/users/snegostup/orgs","repos_url":"https://api.github.com/users/snegostup/repos","events_url":"https://api.github.com/users/snegostup/events{/privacy}","received_events_url":"https://api.github.com/users/snegostup/received_events","type":"User","site_admin":false},"created_at":"2015-12-30T13:58:15Z","updated_at":"2015-12-30T13:58:15Z","body":"May I ask you to drop a line of ES6 (like ```import fs from 'fs'```) to the top of your Broker.js and try to run it? (At the moment you don't have ES6 code there). \r\nI've just tried to test it on fresh SocketCluster boilerplate project and it is the same - ES6 works in Worker, but in Broker it doesn't. It looks like a bug."}}