wasm.websocket.shared.pas 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {
  2. This file is part of the Free Component Library
  3. Webassembly Websocket API - Definitions shared with host implementation.
  4. Copyright (c) 2024 by Michael Van Canneyt [email protected]
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. unit wasm.websocket.shared;
  12. {$mode ObjFPC}{$H+}
  13. interface
  14. uses
  15. {$IFDEF FPC_DOTTEDUNITS}
  16. System.SysUtils;
  17. {$ELSE}
  18. sysutils;
  19. {$ENDIF}
  20. Type
  21. TWasmWebsocketResult = longint;
  22. TWasmWebsocketID = longint;
  23. TWasmWebSocketMessageType = Longint;
  24. TWebsocketCallBackResult = Longint;
  25. {$IFNDEF PAS2JS}
  26. PWasmWebSocketID = ^TWasmWebsocketID;
  27. {$ELSE}
  28. TWasmPointer = longint;
  29. PByte = TWasmPointer;
  30. PWasmWebSocketID = TWasmPointer;
  31. {$endif}
  32. Const
  33. WASMWS_RESULT_SUCCESS = 0;
  34. WASMWS_RESULT_ERROR = -1;
  35. WASMWS_RESULT_NO_URL = -2;
  36. WASMWS_RESULT_INVALIDID = -3;
  37. WASMWS_RESULT_FAILEDLOCK = -4;
  38. WASMWS_RESULT_INVALIDSIZE = -5;
  39. WASMWS_RESULT_NOSHAREDMEM = -6;
  40. WASMWS_RESULT_DUPLICATEID = -7;
  41. WASMWS_CALLBACK_SUCCESS = 0;
  42. WASMWS_CALLBACK_NOHANDLER = -1;
  43. WASMWS_CALLBACK_ERROR = -2;
  44. WASMWS_MESSAGE_TYPE_TEXT = 0;
  45. WASMWS_MESSAGE_TYPE_BINARY = 1;
  46. const
  47. websocketExportName = 'websocket';
  48. websocketFN_Allocate = 'allocate_websocket';
  49. websocketFN_DeAllocate = 'deallocate_websocket';
  50. websocketFN_close = 'close_websocket';
  51. websocketFN_send = 'send_websocket';
  52. implementation
  53. end.