{"id":23246461,"url":"https://github.com/openware/rango","last_synced_at":"2025-08-20T05:31:56.717Z","repository":{"id":40609860,"uuid":"258437595","full_name":"openware/rango","owner":"openware","description":"High performance websocket server","archived":false,"fork":false,"pushed_at":"2024-04-11T02:52:58.000Z","size":118,"stargazers_count":60,"open_issues_count":5,"forks_count":58,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-12-15T19:06:19.026Z","etag":null,"topics":["cryptocurrency-exchange-software","go","golang","server","trades","trading","trading-platform","web-server","websocket"],"latest_commit_sha":null,"homepage":"https://www.openware.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-24T07:21:40.000Z","updated_at":"2024-10-13T16:50:14.000Z","dependencies_parsed_at":"2024-04-11T03:32:14.479Z","dependency_job_id":"fcee259f-434e-4c98-aca5-a2e53da26cb4","html_url":"https://github.com/openware/rango","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openware%2Frango","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openware%2Frango/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openware%2Frango/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openware%2Frango/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openware","download_url":"https://codeload.github.com/openware/rango/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230394175,"owners_count":18218707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptocurrency-exchange-software","go","golang","server","trades","trading","trading-platform","web-server","websocket"],"created_at":"2024-12-19T07:15:09.659Z","updated_at":"2024-12-19T07:15:10.361Z","avatar_url":"https://github.com/openware.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Cryptocurrency Exchange Platform - OpenDAX](https://github.com/openware/meta/raw/main/images/github_opendax.png)\n\n\u003ch3 align=\"center\"\u003e\n\u003ca href=\"https://www.openware.com/sdk\"\u003eGuide\u003c/a\u003e \u003cspan\u003e\u0026vert;\u003c/span\u003e\n\u003ca href=\"https://www.openware.com/sdk/api.html\"\u003eAPI Docs\u003c/a\u003e \u003cspan\u003e\u0026vert;\u003c/span\u003e\n\u003ca href=\"https://www.openware.com/\"\u003eConsulting\u003c/a\u003e \u003cspan\u003e\u0026vert;\u003c/span\u003e\n\u003ca href=\"https://t.me/peatio\"\u003eCommunity\u003c/a\u003e\n\u003c/h3\u003e\n\u003ch6 align=\"center\"\u003eRango is part of \u003ca href=\"https://github.com/openware/opendax\"\u003eOpenDAX Trading Platform\u003c/a\u003e\u003c/h6\u003e\n\n---\n\n# RANGO\n\nRango is a general purpose websocket server which dispatch public and private messages from RabbitMQ.\nRango is made as a drop-in replacement of Ranger built in ruby.\nIt was designed to be very fast, scalable with a very low memory footprint.\n\n## Configuration\n\nTo simplify the migration from Ranger all environement variables are the same:\n\n| VARIABLE          | DEFAULT   | DESCRIPTION                                 |\n| ----------------- | --------- | ------------------------------------------- |\n| RANGER_HOST       | 0.0.0.0   | Hostname to expose the websocket connection |\n| RANGER_PORT       | 8080      | Websocket server port                       |\n| RABBITMQ_HOST     | localhost | RabbitMQ hostname to connect to             |\n| RABBITMQ_PORT     | 5672      | RabbitMQ port                               |\n| RABBITMQ_USER     | guest     | Username used to authenticate to RabbitMQ   |\n| RABBITMQ_PASSWORD | guest     | Password used to authenticate to RabbitMQ   |\n\n## Metrics\n\nRango exposes metrics in Prometheus format on the port 4242.\n\n### Rango metrics\n\n| METRIC                           | TYPE    | DESCRIPTION                                                  |\n| -------------------------------- | ------- | ------------------------------------------------------------ |\n| rango_hub_clients_count | gauge | Number of clients currently connected |\n| rango_hub_subscriptions_count | gauge | Number of user subscribed to a topic |\n\n### HTTP metrics\n\n| METRIC                           | TYPE    | DESCRIPTION                                                  |\n| -------------------------------- | ------- | ------------------------------------------------------------ |\n| promhttp_metric_handler_requests_in_flight | gauge | Current number of scrapes being served. |\n| promhttp_metric_handler_requests_total | counter | Total number of scrapes by HTTP status code. |\n\n### Process metrics\n\n| METRIC                           | TYPE    | DESCRIPTION                                                  |\n| -------------------------------- | ------- | ------------------------------------------------------------ |\n| process_cpu_seconds_total | counter | Total user and system CPU time spent in seconds. |\n| process_max_fds | gauge | Maximum number of open file descriptors. |\n| process_open_fds | gauge | Number of open file descriptors. |\n| process_resident_memory_bytes | gauge | Resident memory size in bytes. |\n| process_start_time_seconds | gauge | Start time of the process since unix epoch in seconds. |\n| process_virtual_memory_bytes | gauge | Virtual memory size in bytes. |\n| process_virtual_memory_max_bytes | gauge | Maximum amount of virtual memory available in bytes. |\n\n### Go standard metrics\n\n| METRIC                           | TYPE    | DESCRIPTION                                                  |\n| -------------------------------- | ------- | ------------------------------------------------------------ |\n| go_gc_duration_seconds{quantile} | summary | A summary of the pause duration of garbage collection cycles. |\n| go_gc_duration_seconds_sum       |         |                                                              |\n| go_gc_duration_seconds_count     |         |                                                              |\n| go_goroutines                    | gauge   | Number of goroutines that currently exist.                   |\n| go_info{version}                 | gauge   | Information about the Go environment.                        |\n| go_memstats_alloc_bytes          | gauge   | Number of bytes allocated and still in use.                  |\n| go_memstats_alloc_bytes_total    | counter | Total number of bytes allocated, even if freed.              |\n| go_memstats_buck_hash_sys_bytes  | gauge   | Number of bytes used by the profiling bucket hash table.     |\n| go_memstats_frees_total          | counter | Total number of frees.                                       |\n| go_memstats_gc_cpu_fraction      | gauge   | The fraction of this program's available CPU time used by the GC since the program started. |\n| go_memstats_gc_sys_bytes         | gauge   | Number of bytes used for garbage collection system metadata. |\n| go_memstats_heap_alloc_bytes     | gauge   | Number of heap bytes allocated and still in use.             |\n| go_memstats_heap_idle_bytes      | gauge   | Number of heap bytes waiting to be used.                     |\n| go_memstats_heap_inuse_bytes     | gauge   | Number of heap bytes that are in use.                        |\n| go_memstats_heap_objects         | gauge   | Number of allocated objects.                                 |\n| go_memstats_heap_released_bytes  | gauge   | Number of heap bytes released to OS.                         |\n| go_memstats_heap_sys_bytes       | gauge   | Number of heap bytes obtained from system.                   |\n| go_memstats_last_gc_time_seconds | gauge   | Number of seconds since 1970 of last garbage collection.     |\n| go_memstats_lookups_total        | counter | Total number of pointer lookups.                             |\n| go_memstats_mallocs_total        | counter | Total number of mallocs.                                     |\n| go_memstats_mcache_inuse_bytes   | gauge   | Number of bytes in use by mcache structures.                 |\n| go_memstats_mcache_sys_bytes     | gauge   | Number of bytes used for mcache structures obtained from system. |\n| go_memstats_mspan_inuse_bytes    | gauge   | Number of bytes in use by mspan structures.                  |\n| go_memstats_mspan_sys_bytes      | gauge   | Number of bytes used for mspan structures obtained from system. |\n| go_memstats_next_gc_bytes        | gauge   | Number of heap bytes when next garbage collection will take place. |\n| go_memstats_other_sys_bytes      | gauge   | Number of bytes used for other system allocations.           |\n| go_memstats_stack_inuse_bytes    | gauge   | Number of bytes in use by the stack allocator.               |\n| go_memstats_stack_sys_bytes      | gauge   | Number of bytes obtained from system for stack allocator.    |\n| go_memstats_sys_bytes            | gauge   | Number of bytes obtained from system.                        |\n| go_threads                       | gauge   | Number of OS threads created.                                |\n\n\n## Start the server\n\n```bash\n./rango\n```\n\n## Scopes\n\nIn rango there are three stream scopes: public, private and prefixed.\n\n### Public\n\nAnyone can register to Public streams, even anonymous users, like orderbook updates, klines and tickers.\nAMQP message with routing key `public.market_id.event` (`public.btcusd.trade`) are routed as public messages.\n\n### Private\n\nWith Private stream the user will receive only the message addressed to him, for example its own order updates or trades.\nAMQP messages with routing key `private.UID.event` (`private.IDABC0000001.trade`) are routed as private messages.\n\n### Prefixed\n\nPrefixed stream scopes are restricted based on user role (RBAC).\nFor example, a specific prefix can be configured so only users with role admin or superadmin will receive messages of this stream.\nAMQP message with routing key `(prefix).market_id.event` (`admin.btcusd.sys`) are routed as prefixed messages.\n\n#### Configure RBAC prefix streams\n\nTo allow specific user roles to connect to prefixed stream, set `RANGO_RBAC_EXAMPLE` env, where ***EXAMPLE*** is the name of the prefix.\nWithout this env, nobody will be allowed to subscribe.\nOne specific environment variable should be set for each rbac stream.\n\nFor example you can configure the streams *admin*, *sys* and *accounting* as follow:\n\n```\nexport RANGO_RBAC_ADMIN=admin,superadmin\nexport RANGO_RBAC_SYS=admin,superadmin,operator\nexport RANGO_RBAC_ACCOUNTING=accountant,operator\n```\n\nUser with role 'accountant' will received messages with route `accounting.asset.new` for example.\n\n## Connect to public channel\n\n```bash\nwscat --connect localhost:8080/public\n```\n\n## Connect to private channel\n\n```bash\nwscat --connect localhost:8080/private --header \"Authorization: Bearer ${JWT}\"\n```\n\n## Messages\n\n### Subscribe to a stream list\n\n```\n{\"event\":\"subscribe\",\"streams\":[\"eurusd.trades\",\"eurusd.ob-inc\"]}\n```\n\n### Unsubscribe to one or several streams\n\n```\n{\"event\":\"unsubscribe\",\"streams\":[\"eurusd.trades\"]}\n```\n\n```\n{\"event\":\"subscribe\",\"streams\":[\"btcusd.trades\",\"ethusd.ob-inc\",\"ethusd.trades\",\"xrpusd.ob-inc\",\"xrpusd.trades\",\"usdtusd.ob-inc\",\"usdtusd.trades\"]}\n```\n\n## License\nBarong JWT is released under the terms of the [Apache License 2.0](LICENSE.md).\n\n## Credits\nMaintained by [Openware](https://github.com/openware) and used in its [cryptocurrency exchange software](https://www.openware.com) stack.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenware%2Frango","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenware%2Frango","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenware%2Frango/lists"}