You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Make InitNetwork() conditional.
- Remove event thread, and move the logic into the main thread. There is no advantage in having two threads, because they both use the same mutex. This also prevents internal lock contention.
- Increased throughput and lower latency due to two changes mentioned above.
- Remove use of ClientQueueEnqueue(*Object, *Client) outside of the server's mutex. This was only called in case AllocateMemory failed, so basically never.
This was mainly a problem on linux systems, as the mutexes seem to work a bit different than on windows.
Copy file name to clipboardExpand all lines: Includes/WebSocket_Server.pbi
+30-87Lines changed: 30 additions & 87 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
;
3
3
; The MIT License (MIT)
4
4
;
5
-
; Copyright (c) 2015-2022 David Vogel
5
+
; Copyright (c) 2015-2025 David Vogel
6
6
;
7
7
; Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
; of this software and associated documentation files (the "Software"), to deal
@@ -140,6 +140,13 @@
140
140
;
141
141
; - V1.006 (05.12.2022)
142
142
; - Add Get_HTTP_Header function and make HTTP_Header structure public
143
+
;
144
+
; - V1.007 (04.04.2025)
145
+
; - Make InitNetwork() conditional.
146
+
; - Remove event thread, and move the logic into the main thread. There is no advantage in having two threads, because they both use the same mutex. This also prevents internal lock contention.
147
+
; - Add delay of 0s to help with external lock contention, this is useful when a user calls server API while the server is busy with sending data.
148
+
; - Increased throughput and lower latency due to two changes mentioned above.
149
+
; - Remove use of ClientQueueEnqueue(*Object, *Client) outside of the server's mutex. This was only called in case AllocateMemory failed, so basically never.
; #### Connect and handshake timeout. The client will be enqueued for this in Thread().
1126
-
If *Client\ConnectTimeout And *Client\ConnectTimeout <= ElapsedMilliseconds()
1127
-
*Client\Event_Disconnect_Manually = #True
1128
-
EndIf
1129
-
1130
1098
; #### Event: Client disconnected (TCP connection got terminated) (Only return this event if there are no incoming frames left to be read by the application)
1131
1099
If *Client\ID = #Null And ListSize(*Client\RX_Frame()) = 0
1132
1100
If *Client\External_Reference
@@ -1181,7 +1149,7 @@ Module WebSocket_Server
1181
1149
DeleteElement(*Client\RX_Frame())
1182
1150
1183
1151
; #### Enqueue again. Either because there are still frames to be read by the user, or because there are no frames anymore and the client can disconnect.
1184
-
ClientQueueEnqueue(*Object, *Client)
1152
+
;ClientQueueEnqueue(*Object, *Client)
1185
1153
1186
1154
; #### Check if any extension bit is set. This lib doesn't support any extensions.
0 commit comments