Hello everyone,
First, I would like to apologize for the very big delay since the last official release. Some of you already know it, I wanted to finish the 6.00 version of PureBasic which was a very big undertaking and it took longer than expected. To make it up to you, for all users which had subscribed to a one year extension (at any time in the past), I decided to renew it freely up to 31. dec 2023 so you can access the new versions.
Now, back on the new release which brings some interesting changes and new features (including the bug fixes from the 2.32 beta version):
Here is an example for the WebSocket lib (with some compressed data as well):
To test it easily, if you have PureBasic you can download this: https://github.com/Dadido3/WebSocket_Server (click on the green "Code" button -> "download as zip" which is an excellent websocket server implementation in PB, and run the Fuzzy/Fuzzy_Server.pb file, it should work out of the box.
Have fun !
The Fantaisie Software Team
First, I would like to apologize for the very big delay since the last official release. Some of you already know it, I wanted to finish the 6.00 version of PureBasic which was a very big undertaking and it took longer than expected. To make it up to you, for all users which had subscribed to a one year extension (at any time in the past), I decided to renew it freely up to 31. dec 2023 so you can access the new versions.
Now, back on the new release which brings some interesting changes and new features (including the bug fixes from the 2.32 beta version):
- - Added WebSocket library: OpenWebSocket(), CloseWebSocket(), SendWebSocketData(), SendWebSocketString()
- - Added Packer library: CompressMemory(), UncompressMemory(), CompressString(), UncompressString()
- - Added Clipboard library: SetClipboardText()
- - Added Event(), EventString(), EventWebSocket()
- - Added FormatNumber()
- - Added Base64Encoder(), Base64Decoder(), Base64EncoderBuffer(), Base64DecoderBuffer()
- - Changed the behaviour of GetMapElement(), it now always creates a new element if not found.
- - StrD will switch to exponent notation if too big (> e+21)
- - Added a timestamp to the index.html to avoid caching problem
- - Added native OS X arm64 version
- - Added all IDE improvement from PureBasic
Here is an example for the WebSocket lib (with some compressed data as well):
Code : | Sélectionner tout |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | Procedure Events() Select Event() Case #PB_Event_Gadget Select EventGadget() Case 0 SendWebSocketString(2, "Hello !") Case 1 *Buffer = AllocateMemory(100) PokeA(*Buffer, 0, 25) PokeA(*Buffer, 10, 26) ;SendWebSocketData(2, *Buffer) ; Send the whole buffer (100 bytes) ;SendWebSocketData(2, *Buffer, 10, 20) ; Send only a part of the buffer (20 bytes starting from 10) ; *Compressed = CompressMemory(*Buffer) *Compressed = CompressString("Test "+Space(1000)+"End") Debug "Compressed size (from 1000 bytes): "+MemorySize(*Compressed) SendWebSocketData(2, *Compressed) EndSelect Case #PB_Event_WebSocket Select EventType() Case #PB_EventType_Connected Debug "WebSocket #" + EventWebSocket() + " connected." Case #PB_EventType_Closed Debug "WebSocket #" + EventWebSocket() + " closed." Case #PB_EventType_String Debug "String recieved on WebSocket #" + EventWebSocket() + "." Debug "String content: " + EventString() Case #PB_EventType_Data Debug "Data recieved on WebSocket #" + EventWebSocket() + "." *Buffer = EventData() Debug "Data size: " + MemorySize(*Buffer) + ". First byte: " + PeekA(*Buffer, 0) ; *Uncompressed = UncompressMemory(*Buffer) ;Debug MemorySize(*Uncompressed) ;Debug PeekA(*Uncompressed, 0) Result$ = UncompressString(*Buffer) Debug Result$ FreeMemory(*Buffer) Case #PB_EventType_Error Debug "Error on WebSocket #" + EventWebSocket() + "." EndSelect EndSelect EndProcedure BindEvent(#PB_Event_Gadget, @Events()) BindEvent(#PB_Event_WebSocket, @Events()) OpenWindow(0, 100, 100, 500, 100, "WebSocket test") ButtonGadget(0, 10, 10, 200, 30, "Send string !") ButtonGadget(1, 10, 45, 200, 30, "Send Data !") If OpenWebSocket(2, "ws://127.0.0.1:8090/") Debug "Trying to open the websocket" Else Debug "Web socket not supported." EndIf |
Have fun !
The Fantaisie Software Team