{"action":"created","issue":{"url":"https://api.github.com/repos/alexfernandez/loadtest/issues/81","labels_url":"https://api.github.com/repos/alexfernandez/loadtest/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/alexfernandez/loadtest/issues/81/comments","events_url":"https://api.github.com/repos/alexfernandez/loadtest/issues/81/events","html_url":"https://github.com/alexfernandez/loadtest/issues/81","id":117934375,"number":81,"title":"Using loadtest without http/https (unexpected way)","user":{"login":"FrankHassanabad","id":1151048,"avatar_url":"https://avatars.githubusercontent.com/u/1151048?v=3","gravatar_id":"","url":"https://api.github.com/users/FrankHassanabad","html_url":"https://github.com/FrankHassanabad","followers_url":"https://api.github.com/users/FrankHassanabad/followers","following_url":"https://api.github.com/users/FrankHassanabad/following{/other_user}","gists_url":"https://api.github.com/users/FrankHassanabad/gists{/gist_id}","starred_url":"https://api.github.com/users/FrankHassanabad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrankHassanabad/subscriptions","organizations_url":"https://api.github.com/users/FrankHassanabad/orgs","repos_url":"https://api.github.com/users/FrankHassanabad/repos","events_url":"https://api.github.com/users/FrankHassanabad/events{/privacy}","received_events_url":"https://api.github.com/users/FrankHassanabad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-19T23:42:07Z","updated_at":"2015-11-20T09:06:35Z","closed_at":null,"body":"Hi!  Been having a great time using loadtetst.  I used it for `https`, but we have other non-https transport protocols that I wanted to integrate with...So...In a completely unexpected way, I dummy out the request and response node objects with requestGenerator.\r\n\r\nI totally don't expect you to support this in any manner, but I wanted to show you how really ...close... your request generator actually is to being transport agnostic which is really cool.\r\n\r\nHere is an ES6 pseudo code'ish version:\r\n\r\n```javascript\r\n// my values from earlier\r\nconst maxRequests       = myMaxRequests;\r\nconst concurrency       = myConcurrency;\r\nconst requestsPerSecond = myRequestsPerSecond\r\n\r\n// load test without using http or https, but rather a different  \r\n// transport protocol.\r\n// I use a dummy return request object as well as a dummy response\r\n// object to accomplish this.\r\nloadTest.loadTest({\r\n  url: 'http://bunk.com',\r\n  maxRequests       : maxRequests,\r\n  concurrency       : concurrency,\r\n  agentKeepAlive    : true,\r\n  requestsPerSecond : requestsPerSecond,\r\n  requestGenerator  : function (params, options, client, callback) {\r\n    return {\r\n      on    : () => {},\r\n      write : () => {},\r\n      end   : () => {\r\n        callback({\r\n          setEncoding : () => {},\r\n          on          : function (signal, onCallback) {\r\n            if (signal === 'end') {\r\n              someNonHttpRequest() // <-- There be the GOLD, my non http promise\r\n              .then((response) => {\r\n                this.statusCode = 200;\r\n                this.body       = response;\r\n                onCallback();\r\n              }).catch((errors) => {\r\n                this.statusCode = errors.statusCode;\r\n                this.body       = errors.body;\r\n                onCallback();\r\n              });\r\n            }\r\n          }\r\n        });\r\n      }\r\n    };\r\n  }\r\n}, (error, result) => {\r\n  //...deal with error and results normally\r\n}\r\n``` \r\n\r\n \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/alexfernandez/loadtest/issues/comments/158330913","html_url":"https://github.com/alexfernandez/loadtest/issues/81#issuecomment-158330913","issue_url":"https://api.github.com/repos/alexfernandez/loadtest/issues/81","id":158330913,"user":{"login":"alexfernandez","id":876570,"avatar_url":"https://avatars.githubusercontent.com/u/876570?v=3","gravatar_id":"","url":"https://api.github.com/users/alexfernandez","html_url":"https://github.com/alexfernandez","followers_url":"https://api.github.com/users/alexfernandez/followers","following_url":"https://api.github.com/users/alexfernandez/following{/other_user}","gists_url":"https://api.github.com/users/alexfernandez/gists{/gist_id}","starred_url":"https://api.github.com/users/alexfernandez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexfernandez/subscriptions","organizations_url":"https://api.github.com/users/alexfernandez/orgs","repos_url":"https://api.github.com/users/alexfernandez/repos","events_url":"https://api.github.com/users/alexfernandez/events{/privacy}","received_events_url":"https://api.github.com/users/alexfernandez/received_events","type":"User","site_admin":false},"created_at":"2015-11-20T09:06:35Z","updated_at":"2015-11-20T09:06:35Z","body":"Actually, loadtest used to support websockets, so it is not as far from testing other protocols. As always, patches are welcome :)"}}