Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

The module WebSocketHelperMBS

module WebSocketHelperMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
module Network MBS Network Plugin 12.5 Yes Yes Yes Yes No
Function: Helper functions for implementing web sockets.
// short packet
dim s as string = WebSocketHelperMBS.AddHeader("Hello")
dim b as Boolean = WebSocketHelperMBS.FrameMasked(s)
dim t as string = WebSocketHelperMBS.Unmask(s)

// long packet
dim text as string = "Hello World. This is just a sample text with a little bit more characters to make it at least 127 characters long for this test."
dim s2 as string = WebSocketHelperMBS.AddHeader(text)
dim b2 as Boolean = WebSocketHelperMBS.FrameMasked(s2)
dim t2 as string = WebSocketHelperMBS.Unmask(s2)

Break // look in debugger
This item is deprecated and should no longer be used. You can use WebSocketMBS instead.

Feedback, Comments & Corrections

  • method AddHeader(data as Memoryblock, opCode as Integer = 7) as Memoryblock
  • method AddHeader(data as string, opCode as Integer = 7) as string
  • method FrameMasked(data as Memoryblock) as boolean
  • method FrameMasked(data as string) as boolean
  • method Unmask(data as Memoryblock) as Memoryblock
  • method Unmask(data as Memoryblock, byref Offset as Integer, byref Length as Integer, byref TotalLength as Integer) as Memoryblock
  • method Unmask(data as string) as string
  • method Unmask(data as string, byref Offset as Integer, byref Length as Integer, byref TotalLength as Integer) as string

Opcode Values

Constant Value Description
kOpCodeBinaryFrame 2 Binary Frame
kOpCodeClose 8 Close
kOpCodeContinuation 0 Continuation
kOpCodeEnd 7 End
kOpCodePing 9 Ping
kOpCodePong 10 Pong
kOpCodeTextFrame 1 Text frame

Blog Entries

The items on this page are in the following plugins: MBS Network Plugin.

MBS Xojo Plugins