mirror of
				https://gitea.invidious.io/iv-org/shard-kemal.git
				synced 2024-08-15 00:53:36 +00:00 
			
		
		
		
	Fix broken websocket routing :/
This commit is contained in:
		
							parent
							
								
									d676b559d2
								
							
						
					
					
						commit
						7dd834ad28
					
				
					 3 changed files with 2 additions and 8 deletions
				
			
		|  | @ -12,7 +12,6 @@ module Kemal | |||
|     Kemal::CLI.new | ||||
|     config = Kemal.config | ||||
|     config.setup | ||||
|     config.add_handler Kemal::RouteHandler::INSTANCE | ||||
|     config.port = port if port | ||||
| 
 | ||||
|     config.server = HTTP::Server.new(config.host_binding, config.port, config.handlers) | ||||
|  |  | |||
|  | @ -57,7 +57,7 @@ module Kemal | |||
|       HANDLERS | ||||
|     end | ||||
| 
 | ||||
|     def add_handler(handler : HTTP::Handler) | ||||
|     def add_handler(handler : HTTP::Handler | HTTP::WebSocketHandler) | ||||
|       setup | ||||
|       HANDLERS.insert @custom_handler_position, handler | ||||
|       @custom_handler_position = @custom_handler_position + 1 | ||||
|  | @ -68,11 +68,6 @@ module Kemal | |||
|       HANDLERS.insert HANDLERS.size - 1, handler | ||||
|     end | ||||
| 
 | ||||
|     def add_ws_handler(handler : HTTP::WebSocketHandler) | ||||
|       setup | ||||
|       HANDLERS << handler | ||||
|     end | ||||
| 
 | ||||
|     def error_handlers | ||||
|       ERROR_HANDLERS | ||||
|     end | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ module Kemal | |||
|   # For each WebSocket route a new handler is created and registered to global handlers. | ||||
|   class WebSocketHandler < HTTP::WebSocketHandler | ||||
|     def initialize(@path : String, &@proc : HTTP::WebSocket, HTTP::Server::Context -> Void) | ||||
|       Kemal.config.add_ws_handler self | ||||
|       Kemal.config.add_handler self | ||||
|     end | ||||
| 
 | ||||
|     def call(context) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue