🐛 Fix ipc server on web
This commit is contained in:
		| @@ -9,9 +9,11 @@ import 'package:shelf/shelf.dart'; | |||||||
| import 'package:shelf/shelf_io.dart' as shelf_io; | import 'package:shelf/shelf_io.dart' as shelf_io; | ||||||
| import 'package:shelf_web_socket/shelf_web_socket.dart'; | import 'package:shelf_web_socket/shelf_web_socket.dart'; | ||||||
| import 'package:web_socket_channel/web_socket_channel.dart'; | import 'package:web_socket_channel/web_socket_channel.dart'; | ||||||
| import 'ipc_server.dart'; |  | ||||||
| import 'ipc_server.windows.dart'; | // Conditional imports for IPC server - use web stubs on web platform | ||||||
| import 'ipc_server.unix.dart'; | import 'ipc_server.dart' if (dart.library.html) 'ipc_server.web.dart'; | ||||||
|  | import 'ipc_server.windows.dart' if (dart.library.html) 'ipc_server.web.dart'; | ||||||
|  | import 'ipc_server.unix.dart' if (dart.library.html) 'ipc_server.web.dart'; | ||||||
|  |  | ||||||
| const String kRpcLogPrefix = 'arRPC.websocket'; | const String kRpcLogPrefix = 'arRPC.websocket'; | ||||||
| const String kRpcIpcLogPrefix = 'arRPC.ipc'; | const String kRpcIpcLogPrefix = 'arRPC.ipc'; | ||||||
|   | |||||||
							
								
								
									
										63
									
								
								lib/pods/activity/ipc_server.web.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								lib/pods/activity/ipc_server.web.dart
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | |||||||
|  | // Stub implementation for web platform | ||||||
|  | // This file provides empty implementations to avoid import errors on web | ||||||
|  |  | ||||||
|  | // IPC Packet Types | ||||||
|  | class IpcTypes { | ||||||
|  |   static const int handshake = 0; | ||||||
|  |   static const int frame = 1; | ||||||
|  |   static const int close = 2; | ||||||
|  |   static const int ping = 3; | ||||||
|  |   static const int pong = 4; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // IPC Close Codes | ||||||
|  | class IpcCloseCodes { | ||||||
|  |   static const int closeNormal = 1000; | ||||||
|  |   static const int closeUnsupported = 1003; | ||||||
|  |   static const int closeAbnormal = 1006; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // IPC Error Codes | ||||||
|  | class IpcErrorCodes { | ||||||
|  |   static const int invalidClientId = 4000; | ||||||
|  |   static const int invalidOrigin = 4001; | ||||||
|  |   static const int rateLimited = 4002; | ||||||
|  |   static const int tokenRevoked = 4003; | ||||||
|  |   static const int invalidVersion = 4004; | ||||||
|  |   static const int invalidEncoding = 4005; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // IPC Packet structure | ||||||
|  | class IpcPacket { | ||||||
|  |   final int type; | ||||||
|  |   final Map<String, dynamic> data; | ||||||
|  |  | ||||||
|  |   IpcPacket(this.type, this.data); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | class IpcServer { | ||||||
|  |   Future<void> start() async {} | ||||||
|  |   Future<void> stop() async {} | ||||||
|  |   void Function(dynamic, dynamic, dynamic)? handlePacket; | ||||||
|  |   void addSocket(dynamic socket) {} | ||||||
|  |   void removeSocket(dynamic socket) {} | ||||||
|  |   List<dynamic> get sockets => []; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | class IpcSocketWrapper { | ||||||
|  |   String clientId = ''; | ||||||
|  |   bool handshook = false; | ||||||
|  |  | ||||||
|  |   void addData(List<int> data) {} | ||||||
|  |   void send(Map<String, dynamic> msg) {} | ||||||
|  |   void sendPong(dynamic data) {} | ||||||
|  |   void close() {} | ||||||
|  |   void closeWithCode(int code, [String message = '']) {} | ||||||
|  |   List<dynamic> readPackets() => []; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | class WindowsIpcServer extends IpcServer {} | ||||||
|  |  | ||||||
|  | class UnixIpcServer extends IpcServer {} | ||||||
|  |  | ||||||
|  | class WindowsIpcSocketWrapper extends IpcSocketWrapper {} | ||||||
		Reference in New Issue
	
	Block a user