Repository

THIS IS NOT MAINTAINED

This implementation is now a part of V and this means there are no reason to maintain this version. I keep it for future references.

New V-websocket library

This is a refactor of the current web socket library to comply with V-like style of programming. It is built on top of Emily net library and passes all the autobahn tests for clients.

Changes from original websocket implementation

  • Use only built-in datatypes, no voidptrs or byteptr (for now the eventbus require it for callbacks)
  • Relying on V automatic free of resources (not done yet)
  • Client and Server pass autobahn tests excluding compression
  • Use new socket implementation from @Ememily33901 that will soon be standard in V
  • Use Option error handling
  • Refactor code so websocket.v contains only the code to understand basic implementations
    • moved communication to io.v
    • separation of handling frames and finished messages
  • Eventbus dependency removed and using own fn types. Now register callbacks with on_message, on_error, on_open, on_close functions
  • Easy to use webbsocket server

Proposed / planned changes

  • Make server autobahn compliant like client
  • Set own timeouts
  • Make sure it works on windows
  • Strict comply to utf8 autobahn fast fail rule (it comply now but non strict)
  • Publish as module
  • Set if autoping in server = false if time is 0

Future changes after v0.2 of V

  • Generics, use vweb type of app instead of voidptr for reference
  • Interfaces, IO operations as interfaces for making tests more easy

Remarks

  • It should not be used in production since memory management is not done yet in V

Attribution

About

0
67
1 year ago

Author

helto4real