Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

thor

> 编程语言
Open source

The WebSocket god of thunder

1.3K stars0 likes2 views
WebsiteGitHub

About

The WebSocket god of thunder

Thor

Thor is WebSocket benchmarking/load generator. There are a lot of benchmarking tools for HTTP servers. You've got ab, siege, wrk and more. But all these tools only work with plain ol HTTP and have no support for WebSockets - even if they did they wouldn't be suitable, as they would be testing short running HTTP requests instead of long running HTTP requests with a lot of messaging traffic. Thor fixes all of this.

Dependencies

Thor requires Node.js to be installed on your system. If you don't have Node.js installed you can download it from http://nodejs.org or build it from the github source repository: http://github.com/joyent/node.

Once you have Node.js installed, you can use the bundled package manager npm to install this module:

bash
npm install -g thor

The -g command flag tells npm to install the module globally on your system.

Usage

thor [options] 

Thor can hit multiple URL's at once; this is useful if you are testing your reverse proxies, load balancers or just simply multiple applications. The url that you supply to thor should be written in a WebSocket compatible format using the ws or wss protocols:

thor --amount 5000 ws://localhost:8080 wss://localhost:8081

The snippet above will open up 5000 connections against the regular ws://localhost:8080 and also 5000 connections against the secured wss://localhost:8081 server, so a total of 10000 connections will be made.

One thing to keep in mind is you probably need to bump the amount of file descriptors on your local machine if you start testing WebSockets. Set the ulimit -n on machine as high as possible. If you do not know how to do this, Google it.

Options

…

Some small notes about the options:

  • --protocol is the protocol version number. If you want to use the HyBi drafts 07-12 use 8 as argument or if you want to use the HyBi drafts 13-17 drafts which are the default version use 13.
  • --buffer should be size of the message in bytes.
  • --workers as Node.js is single threaded this sets the amount of sub processes to handle all the heavy lifting.

Custom messages

Some WebSocket servers have their own custom messaging protocol. In order to work with those servers we introduced a concept called generators a generator is a small JavaScript file that can output utf8 and binary messages. It uses a really simple generator by default.

Checkout https://github.com/observing/thor/blob/master/generator.js for an example of a generator.

thor --amount 1000 --generator  ws://localhost:8080

Example

thor --amount 1000 --messages 100 ws://localhost:8080

This will hit the WebSocket server that runs on localhost:8080 with 1000 connections and sends 100 messages over each established connection. Once thor is done with smashing your connections it will generate a detailed report:

…

License

MIT

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言