mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 13:42:59 +00:00 
			
		
		
		
	Increase the maximum limit for websocket messages
The constructor for the websocket handshaker has a default maxFramePayloadLength of 64kb, hence me being confused. Closes #376
This commit is contained in:
		| @@ -22,7 +22,6 @@ import dan200.computercraft.api.turtle.ITurtleUpgrade; | |||||||
| import dan200.computercraft.api.turtle.event.TurtleAction; | import dan200.computercraft.api.turtle.event.TurtleAction; | ||||||
| import dan200.computercraft.core.apis.AddressPredicate; | import dan200.computercraft.core.apis.AddressPredicate; | ||||||
| import dan200.computercraft.core.apis.ApiFactories; | import dan200.computercraft.core.apis.ApiFactories; | ||||||
| import dan200.computercraft.core.apis.http.websocket.Websocket; |  | ||||||
| import dan200.computercraft.core.computer.MainThread; | import dan200.computercraft.core.computer.MainThread; | ||||||
| import dan200.computercraft.core.filesystem.ComboMount; | import dan200.computercraft.core.filesystem.ComboMount; | ||||||
| import dan200.computercraft.core.filesystem.FileMount; | import dan200.computercraft.core.filesystem.FileMount; | ||||||
| @@ -128,7 +127,7 @@ public class ComputerCraft | |||||||
|     public static long httpMaxDownload = 16 * 1024 * 1024; |     public static long httpMaxDownload = 16 * 1024 * 1024; | ||||||
|     public static long httpMaxUpload = 4 * 1024 * 1024; |     public static long httpMaxUpload = 4 * 1024 * 1024; | ||||||
|     public static int httpMaxWebsockets = 4; |     public static int httpMaxWebsockets = 4; | ||||||
|     public static int httpMaxWebsocketMessage = Websocket.MAX_MESSAGE_SIZE; |     public static int httpMaxWebsocketMessage = 128 * 1024; | ||||||
|  |  | ||||||
|     public static boolean enableCommandBlock = false; |     public static boolean enableCommandBlock = false; | ||||||
|     public static int modem_range = 64; |     public static int modem_range = 64; | ||||||
|   | |||||||
| @@ -40,7 +40,11 @@ import java.util.concurrent.Future; | |||||||
|  */ |  */ | ||||||
| public class Websocket extends Resource<Websocket> | public class Websocket extends Resource<Websocket> | ||||||
| { | { | ||||||
|     public static final int MAX_MESSAGE_SIZE = 64 * 1024; |     /** | ||||||
|  |      * We declare the maximum size to be 2^30 bytes. While messages can be much longer, we set an arbitrary limit as | ||||||
|  |      * working with larger messages (especially within a Lua VM) is absurd. | ||||||
|  |      */ | ||||||
|  |     public static final int MAX_MESSAGE_SIZE = 1 << 30; | ||||||
|  |  | ||||||
|     static final String SUCCESS_EVENT = "websocket_success"; |     static final String SUCCESS_EVENT = "websocket_success"; | ||||||
|     static final String FAILURE_EVENT = "websocket_failure"; |     static final String FAILURE_EVENT = "websocket_failure"; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 SquidDev
					SquidDev