Results 1 to 40 of 55

Thread: [VB6] Visual Basic 6 Client Websocket Control 1.11 BETA

Threaded View

  1. #1

    Thread Starter
    Lively Member vbLewis's Avatar
    Join Date
    Feb 2009
    Location
    USA
    Posts
    127

    [VB6] Visual Basic 6 Client Websocket Control 1.11 BETA

    Greetings Friends,

    I present to you the first free client Websocket UserControl made in Visual Basic 6 (with source code) that can handle both secure (ssl/ssh) and normal websocket server connections!


    Name:  ss6.jpg
Views: 9065
Size:  41.0 KB
    Name:  ss7.jpg
Views: 8497
Size:  31.0 KB

    I have personally had to abandon 3 large personal projects of my own because i needed websocket functionality with SSL and couldn't find anything on the internet to fulfill that need (free or open source). I started a couple times to try to code one of my own but the extreme complexity of implementing SSL and lack of time always hindered my progress and I usually gave up an moved on to something else. (if you check the SSL code you will know what i mean by complex).

    But then alas, one day I stumbled upon wqweto's VBAsyncSocket project and hope once again glimmered in my eyes. Here was a project with full SSL/TLS implementation that worked seamlessly under the hood and supported IPV6 to boot. I then came across joshyfrancis's post regarding a websocket server, which led me to Youran's online example code. All of which helped me in achieving my goal of creating a client websocket control in VB6. This project wouldn't have been possible without those people's contributions. Hopefully, you will find this useful and beneficial to your websocket related projects.

    Note, this websocket doesnt support application layer protocols, and full HTTP header handling, mainly because it doesn't have the full power of a web browser behind it like most websockets. As such it handles only the most simplest of http redirects where location: in the header defines the new URL. Amazon Cloudfront redirects for example are not handled. You are also responsible for any data formatting such as JSON, XML etc.. This control only deals with the actual websocket protocol layer.

    Some Uses for a Websocket control are:

    1) Connect to and control OBS Studio with the OBS-WebSocket plugin.
    2) Connect to cryptocurrency websites and retrieve pricing and/or actually make trades
    3) Connect to sports sites and get sports ticker information
    4) Easily implement multimedia chat, text chat, and shared drawing
    5) Similar to crypto, connect to Stock sites and get financial information and tickers
    6) Connect to Social Media Sites and get real-time timeline updates
    7) Connect to Twitch IRC chat and implement a chat bot


    Please post any bugs or questions related to the websocket control below and I will try to fix them as much as possible. If you make any useful additions, please share them so they can be added into the main source code.

    Please direct any questions regarding the SSL code to wqweto as I don't know crap about SSL.

    best regards,
    vbLewis


    UPDATE Version 1.11 BETA - 5/12/2022

    Summary: Added a SendAdvanced() function and fixed a serious bug in CollapseFramesEx(). Also converted to a single EXE project. Piesocket demo not currently working because demo key is invalid.

    1) Added a SendAdvanced() function to allow for sending extension data and/or fine-grained control of the message construction. Some of the same rules apply as the regular Send() function,for example: if you specify blnUTF8Encode then the data should be a text string (normal VB String type) or else it will be treated as a binary string and converted to a byte array and not encoded. Also if you specify compression you must have set the UseCompression option to true before connecting. If you specify compression then RSV1 will be set to true by the websocket. Also Data can only be a byte array or a string. Empty data can be sent.
    2) Had some time to make this control do work in a real environment and discovered a serious bug in the CollapsFramesEx() function having to do with gathering opContinue frames. Seems to work ok now.
    3) Converted entire project to a single EXE project instead of a project group. This will make it easier to add files to a new project instead of having to create a reference to the project or compile it to an OCX. In order to compile as an OCX you will have to create a new Active X project and re-add all the files to it. You will also have to move some Types and Enums back into the Usercontrol. Some Types and Enums had to be moved to the BAS module because of how Usercontrols work in an EXE project. In the future I may include both project types in a single download.
    4) Piesockets demo key was invalidated for some reason and I havent had time to get or look for a new one.
    5) Removed the humanitarian link after thinking about it and decided politics have no place in the global language of programming.


    UPDATE Version 1.10 BETA - 4/10/2022

    1) major update to the Piesocket example to showcase multiple clients, you can spawn as many clients as you want
    2) small bug fix in disconnect function, dont set readyState back to closing if already closed


    UPDATE Version 1.9 BETA - 4/6/2022

    1) major bug fix in Send() function (again). When collapsing code from 2 loops into 1, forgot to include binary sends. yikes
    2) all data is now encoded or compressed as needed before the chunk sending loop begins to be more in line with the protocol.
    3) tightened up the Send function code to be smaller, faster and more optimized, added more data integrity checks.
    4) Started working on removing unused code in the compressor and ssl/tls socket code. There is alot of unused code. For now code is just commented out till I can be sure it isnt required by deflate/inflate or the rest of the class code. This will eventually help bring the project code size down significantly and help with load times. Also there is alot of duplicate code in all the classes that could be collected into one code base module.
    5) added a new event onReConnect, that fires if the server is redirecting the connection. this allows you to change the url/uri in any gui display
    6) added a link to support humanitarian aid to ukraine.


    UPDATE Version 1.8 BETA - 4/3/2022
    Just when I think the code is nice and stable I seem to find a bug that makes me wonder how this thing even worked at all. That being said, it seems like it is working pretty good right now. The biggest change in this update is support for extensions.

    1) Now a default "Origin: http:server.com/path" header is included if one is not specified by the user
    2) Added optional NoUTF8Conversion parameter to the Send() function to allow sending strings as binary, has no effect on byte arrays.
    3) A new property ChunkSize specifies the size of chunks to send. Use this to fine tune your sends, default 4kb, max 16kb recommended
    4) The onMessage event now has a new parameter called opCode that lets you know what type of data is in the websocket message opText(1) or opBinary(2) or extended opcode
    5) added support for extension op codes (3-7, 11-15) and raw extension data which is handled as an untouched byte array. this means you will know how to interpret the data
    6) Updated the html help file to reflect new properties and parameters
    7) updated the echo websocket demo to work again with a new server thanks to Lob.com




    Known Issues:
    1) Proxies are not supported, will probably add support in a future update.
    2) There are several features (such as compression) that have not been tested because I cant find a server to test them with, but in theory they should work so long as the code is correct.


    See CHANGELOG.txt for older updates.
    Attached Files Attached Files
    Last edited by vbLewis; May 12th, 2022 at 04:01 AM. Reason: updated version to 1.11

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width