websocket icon indicating copy to clipboard operation
websocket copied to clipboard

[feature] concurrent safe write function

Open 0x-3FFF opened this issue 3 years ago • 5 comments

currently, the implementation of the write series function is concurrency-unsafe, it is recommended to introduce a concurrency-safe write function

0x-3FFF avatar Nov 03 '22 15:11 0x-3FFF

Concurrent writes are the top support issue for this package.

It's not useful to make the current methods threadsafe given the overall design of the API, but it might be worth doing to reduce the support burden.

ghost avatar Jun 15 '24 02:06 ghost

I've been thinking about this for awhile. Do we support thread-safeness into the future or do we just say "too bad" and ask folks to find a better library. I'm not entirely sure.

jaitaiwan avatar Jun 15 '24 03:06 jaitaiwan

Drive the concurrency-related issues elsewhere by making the individual methods threadsafe. Support thread safety into the future.

Developers of robust applications will want to handle concurrency within their application code. The current API is no hindrance to those developers and may be preferable to other APIs.

I read through the examples in this repository and don't see how additional thread safety in the package will benefit them. Perhaps I need to spend more time looking at them. As an interesting side note, none of the examples use sync.Mutex.

ghost avatar Jun 15 '24 05:06 ghost