chipkeron.blogg.se

Purebasic openwindow
Purebasic openwindow






purebasic openwindow

PokeA(*Framebuffer + pos, MsgLength > 24) : pos + 1 We don't support giant packages for now, so first bytes are zero :P PokeA(*Framebuffer + pos, 0) : pos + 1 8 Bytes for payload lenght. PokeA(*Framebuffer + pos, 127 + 128) : pos + 1 127 for 8 extra length bytes and + 128 for Masking PokeA(*FrameBuffer + pos, MsgLength) : pos + 1 Second ByteĮlse It's bigger than 65535, we also use 8 extra bytes If MsgLength = 126 And MsgLength = 126 And MsgLength > 8)) : pos + 1 First Byte PokeS(*MsgBuffer, message.s, MsgLength, #PB_UTF8|#PB_String_NoZero)ĭbg("Messagelength to send: " + Str(MsgLength)) MsgLength.l = StringByteLength(message.s, #PB_UTF8) Procedure SendTextFrame(connection, message.s) PokeA(*Buffer + i, PeekA(*Buffer + i) ! Mask(i % 4)) Procedure ApplyMasking(Array Mask.a(1), *Buffer) If FindString(Answer.s, "HTTP/1.1 101") And FindString(Answer.s, "CONNECTION: UPGRADE") And FindString(Answer.s, "UPGRADE: WEBSOCKET") Size = ReceiveNetworkData(connection, *Buffer, 65536)Īnswer.s = Answer.s + PeekS(*Buffer, Size, #PB_UTF8) SendNetworkString(Connection, Request.s, #PB_UTF8) "User-Agent: CustomWebsocketClient"+ #CRLF$ + #CRLF$ "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ=" + #CRLF$ +

purebasic openwindow

Procedure Handshake(Connection, Servername.s, Path.s) If Handshake(Connection, Servername.s, Path.s) Configure the proxy with SetSSLProxy().")Ĭonnection = OpenNetworkConnection(Servername.s, Port.l, #PB_Network_TCP, 1000) If Protokol.s = "wss" If we connect with encryption (https)Ĭonnection = OpenNetworkConnection(Proxy_Server.s, Proxy_Port.l, #PB_Network_TCP, 1000)ĭbg("We need an SSL-Proxy like stunnel for encryption. Port.l = Val(GetURLPart(URL.s, #PB_URL_Port)) Servername.s = GetURLPart(URL.s, #PB_URL_Site)

purebasic openwindow

Protokol.s = GetURLPart(URL.s, #PB_URL_Protocol) Procedure SetSSLProxy(ProxyServer.s = "", ProxyPort.l = 8182) TODO: Support to send receive bigger framesĭeclare Handshake(Connection, Servername.s, Path.s)ĭeclare ApplyMasking(Array Mask.a(1), *Buffer)ĭebug "WebsocketClient: " + FormatDate("%yyyy-%mm-%dd %hh:%ii:%ss",Date()) + " > " + txt TODO: We should send an closing frame, but server will also just close TODO: We don't support fragmetation right now You not really need the list, you can also get the values of the specified desktop inside the procedure.Declare SendTextFrame(connection, message.s)ĭeclare ReceiveFrame(connection, *MsgBuffer)ĭeclare SetSSLProxy(ProxyServer.s = "", ProxyPort.l = 8182) Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow MoveWindowToDesktop(0, 0, 0, 0, DesktopList(), #PB_Window_ScreenCentered) ResizeWindow(Window, DesktopList()\X + x, DesktopList()\Y + y, #PB_Ignore, #PB_Ignore) Y = (DesktopList()\Height - WindowHeight(Window)) / 2 X = (DesktopList()\Width - WindowWidth(Window)) / 2 Procedure MoveWindowToDesktop(Window.i, Desktop.i, x.i, y.i, List DesktopList.DesktopStructure(), Flags.i=0) ResizeWindow(AppWindow, DesktopX(1) + (DesktopWidth(1) - WindowWidth(AppWindow))/2, DesktopY(1) + (DesktopHeight(1) - WindowHeight(AppWindow))/2, #PB_Ignore, #PB_Ignore) ResizeWindow(AppWindow, DesktopX(1), DesktopY(1), #PB_Ignore, #PB_Ignore) SetGadgetText(21, "# OK #") sen a message to 2nd MonitorĬode: Select all mainWindow = OpenWindow(0,50,50,300,300,"Main Window",#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget|#PB_Window_SystemMenu)ĪppWindow = OpenWindow(#PB_Any, 0, 0, WindowWidth(0), WindowWidth(0), "Second screen window", #PB_Window_BorderLess ) If CocoaMessage(0, ScreenArray, "count") < 2ĮxternalWindow = CocoaMessage(0, ScreenArray, "objectAtIndex:", 1), "visibleFrame")ĪppWindow = OpenWindow(#PB_Any, 0, 0, 0, 0, "Second screen window", #PB_Window_BorderLess ) ScreenArray = CocoaMessage(0, 0, "NSScreen screens")








Purebasic openwindow