Page 1 of 2 12 LastLast
Results 1 to 40 of 46

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

  1. #1

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

    [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: 4093
Size:  41.0 KB
    Name:  ss7.jpg
Views: 3674
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

  2. #2
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    EspaƱa
    Posts
    506

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Very good work.
    I am trying to connect to the next server, but it gives me problems, it disconnects from the server.

    It works well
    Code:
    wss://echo.websocket.org
    this not

    apikey is real apikey.
    http://piesocket.com
    Code:
    wss://us-nyc-101.piesocket.com/v3/1?api_key=apikey&notify_self
    Good work, keep it up

  3. #3

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

    Re: [VB6] Visual Basic 6 Client Websocket Control

    its supposed to handle query params but the server might be returning something in the header, ill have to do more testing.. I forgot to mention that redirects to amazons cloudfront servers arent handled.

    Edit:
    Dear Yokesee, it appears that server is no longer online or its DNS isn't working, error is "No such Host is Known"

    I have tried there demo sever and it connects, however it doesnt support chat, superchat, or echo protocols which basically means
    the piesocket servers require all messages to be formatted in json encoding.
    Last edited by vbLewis; Aug 1st, 2021 at 03:57 AM.

  4. #4
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: [VB6] Visual Basic 6 Client Websocket Control

    it's nice,how to change for serve mode?
    use ie to connect wss://127.0.0.1:443?

  5. #5

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

    Re: [VB6] Visual Basic 6 Client Websocket Control

    you should be able to just put wss://127.0.0.1:443 in the text1 to connect to a local server, i havent tried that myself. Also this is a "Client" only control, doesnt do server mode.

  6. #6
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Quote Originally Posted by vbLewis View Post
    Greetings Friends,

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

    Attachment 181963

    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. 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. I took the version i was working on an stripped it down to a bare-bones version to keep it as simple as possible added an example and have posted it here for your use as you see fit. This project wouldn't have been possible without those people's contributions.

    Hopefully, you will find this useful and beneficial to your web related projects.

    Note, this websocket doesnt support protocol extensions, 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. you will be responsible for any data formatting such as JSON, XML etc.. This control only deals with the actual websocket protocol layer. I will be implementing much more functionality into the control as time allows.

    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.

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

    best regards,
    vbLewis
    Well done, thank you. It would be better if you can add ws function

    I tested and found that ws://127.0.0.1:2007 could not find the service. But I can successfully connect with the web page test
    Last edited by xxdoc123; Aug 1st, 2021 at 07:45 PM.

  7. #7

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

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Dear xxdoc123.

    There was a bug where the crypto sub system wasn't initialized if a secure socket (wss://) wasn't first used before a non-secure one (ws://) causing the sha1 hash function to fail that is used to authenticate a server regardless of mode. That bug has been squashed in update 1.1

    WS:// is full implemented same as wss:// ... You have to have a local server running in order to connect to a local server. This is a client only control. you can try ws://echo.websocket.org to see that it works.

  8. #8
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    EspaƱa
    Posts
    506

    Re: [VB6] Visual Basic 6 Client Websocket Control

    thanks for the update.
    but I still have the same problems.
    to connect
    Quote Originally Posted by yokesee View Post
    Very good work.
    I am trying to connect to the next server, but it gives me problems, it disconnects from the server.

    It works well
    Code:
    wss://echo.websocket.org
    this not

    apikey is real apikey.
    http://piesocket.com
    Code:
    wss://us-nyc-101.piesocket.com/v3/1?api_key=apikeyĀ¬ify_self
    Good work, keep it up

  9. #9

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

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Dear Yokesee,
    The reason you couldnt connect to piesocket was the following:
    1) piesocket apparently doesnt care about standards and makes up their own as they go....
    2) they require a "Content-Type: application/json" header option (completely non-standard)
    3) they dont unencode the query parameters so it completely chokes on encoded server path params (also non-standard)
    4) all data sent after connection must be encoded in json (this is the only thing thats standard)
    5) No sub protocols can be specified, and even if an empty "Sec-Websocket-Protocol" is in the header it will disconnect you (completely non-standard)

    VBWebsocket has been modified to accomodate all piesockets non standard behavior, and you should now be able to connect....
    Just a reminder though... all data needs to be json encoded.

    regards,
    Lewis

  10. #10
    New Member
    Join Date
    Aug 2021
    Posts
    4

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Hello Lewis,

    Let me preface this with a big thank you for working on this control. I know it is challenging.

    I am encountering a subscript out of range error when trying to subscribe to feeds form coinbase.com. It appears that I can connect, but when I send a message, I am immediately disconnected. I compiled the VBWebsocket.vbp into and OCX. When I open the Project1 project, everything is good. When pointing the app toward https://ws-feed.pro.coinbase.com server, I can connect but I am getting a "subscript out of range" message when trying to send a subscription message.

    Is there a way to include the VBWebsocket.vbp files and run everything from source code, instead of adding the .ocx into the toolbar??

    I am an old-school VB programmer from back in the 90's, but has not picked up the keyboard for a couple decades.

  11. #11
    New Member
    Join Date
    Aug 2021
    Posts
    4

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Quote Originally Posted by manaloea View Post
    Hello Lewis,

    Let me preface this with a big thank you for working on this control. I know it is challenging.

    I am encountering a subscript out of range error when trying to subscribe to feeds form coinbase.com. It
    I found the issue. The server in Coinbase that I was subscribing to was the "ticker" feed. This quickly overloaded the list box that displays the server responses. when I changed subscription to a "heartbeat" feed, I was able to see the incoming message.

    Again, many thanks for putting this project together.

  12. #12

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

    Re: [VB6] Visual Basic 6 Client Websocket Control

    hi manaloea,

    It appears your use of the websocket is similar to my needs as far as getting crypto feeds and data. There will be a huge update soon that should fix alot of issues. Im glad you found a good use for this project.

  13. #13
    New Member
    Join Date
    Aug 2021
    Posts
    4

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Thank you.

    Now, I am trying to convert your OCX into a DLL to use in VBA-Excel. This is because I wrote some code in VBA to pull Crypto data from Coinbase Pro, and to automatically initiate trades, based on certain criteria. Kinda like an automated day-trader. Excel does a good job of visually and graphically representing data, but hit a wall with websockets. This is probably because the XMLHTTP60 and Internet Controls libraries do not handle the bi-directional communications. But if I can get a DLL to function within the VBA infrastructure, it would be the best of both worlds. Worst case, I will make a bridge between my Excel VBA and your websockets.

  14. #14

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

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Quote Originally Posted by manaloea View Post
    Thank you.

    Now, I am trying to convert your OCX into a DLL to use in VBA-Excel. This is because I wrote some code in VBA to pull Crypto data from Coinbase Pro, and to automatically initiate trades, based on certain criteria. Kinda like an automated day-trader. Excel does a good job of visually and graphically representing data, but hit a wall with websockets. This is probably because the XMLHTTP60 and Internet Controls libraries do not handle the bi-directional communications. But if I can get a DLL to function within the VBA infrastructure, it would be the best of both worlds. Worst case, I will make a bridge between my Excel VBA and your websockets.
    Sounds very cool. You will want to use the updated 1.3 version as it fixes several very bad bugs. I also included and example of how to use the coinbase ticker. enjoy!

  15. #15
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    EspaƱa
    Posts
    506

    Re: [VB6] Visual Basic 6 Client Websocket Control

    very good update.
    Could you help me with a problem with piesocket.com.
    I am logged out every 30 seconds or less.

    greetings and very good job

  16. #16

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

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Quote Originally Posted by yokesee View Post
    very good update.
    Could you help me with a problem with piesocket.com.
    I am logged out every 30 seconds or less.

    greetings and very good job
    hi yokesee,
    I have narrowed the problem down to a TLS error/Winsock Error. i get the following 2 errors in the system event log "A fatal error occurred while creating a TLS client credential. The internal error state is 10013." after looking up error 10013 (a winsock error) it states "An attempt was made to access a socket in a way forbidden by its access permissions."

    This may take a while to track down but Im looking for a solution and debugging. It may be that piesocket doesnt support tls 1.3 and might need to go back to tls 1.2 etc. not sure.... will let you know when i have a better answer.

    regards,
    lewis

  17. #17
    Hyperactive Member
    Join Date
    Jun 2016
    Location
    EspaƱa
    Posts
    506

    Re: [VB6] Visual Basic 6 Client Websocket Control

    thanks a lot

  18. #18

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

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Quote Originally Posted by yokesee View Post
    thanks a lot
    Dear Yokesee,
    I have found the issue, it was a bug with answering pings silently. I will be posting a bug fix update in a little while after i add some more code to handle buffered frames in ping,pong, and close op code frames.

    for now you can do a quick fix by doing the following...
    In the websocket usercontrol find the function ProcessData and change the following 2 lines of code

    Code:
                    Data(0) = &H8A
                    TlsSock.SendArray Data
    to the following 2 lines of code
    Code:
                    E = ExtractData(Data, DF)
                    TlsSock.SendArray PackMaskData(E, UBound(E) + 1, False, opPong, True)

    that should fix the issue with getting disconnected. I have also enhanced the PieSocket demo which i will be posting with the next update.
    regards,
    lewis

  19. #19
    New Member
    Join Date
    Aug 2021
    Posts
    4

    Re: [VB6] Visual Basic 6 Client Websocket Control

    Quote Originally Posted by vbLewis View Post
    Sounds very cool. You will want to use the updated 1.3 version as it fixes several very bad bugs. I also included and example of how to use the coinbase ticker. enjoy!
    Many Thanks!

  20. #20
    New Member
    Join Date
    Mar 2022
    Posts
    4

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.5 BETA

    Hi Many thanks for that control !
    I'm using it with a nodejs sever and sending it json string.
    When the json is not too large, everything works perfectly. When my json is larger, the server crash with a 1002 error. Do you have an idea ?

    Here is an exemple of the json that fails.

    Many thanks for your help !

    {"action":"publish","payload":{"message":{"competition":{"timeAllowed":"82s / 53s","total":"25","left":"4","clear":"5","finish":""},"live":{"order":28,"hnb":24,"rider":"Nicolas HOUZELLE","nation":"FRA","horse":"CRAZY GIRL DES LOTUS","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"0" }},"last":{"order":27,"hnb":23,"rider":"Olivier ROBERT","nation":"FRA","horse":"CARECA LS ELITE","results":{"entryRank":"10","fencePen1":"4","timePen1":"0","totalPen1":"4","time1":"78.3","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"78.30","totalPen":"4" }},"ranking":[{"order":1,"hnb":28,"rider":"Gaetan POIDVIN","nation":"FRA","horse":"VOLUPTE DE L'EXTASE","results":{"entryRank":"1","fencePen1":"0","timePen1":"0","totalPen1":"0","time1":"79.21","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"79.21","totalPen":"0" }},{"order":2,"hnb":29,"rider":"Damien DEMAISON","nation":"FRA","horse":"CHILOE DE KREISKER","results":{"entryRank":"16","fencePen1":"8","timePen1":"0","totalPen1":"8","time1":"79.06","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"79.06","totalPen":"8" }},{"order":3,"hnb":30,"rider":"Paul TYSSANDIER","nation":"FRA","horse":"AKUNA MATATA DB Z","results":{"entryRank":"21","fencePen1":"16","timePen1":"2","totalPen1":"18","time1":"88.07","fencePen2":"","timePen2":"2","totalPen2":"","time2":"","totalTime":"88.07","totalPen":"18" }},{"order":4,"hnb":31,"rider":"Tomas COUVE CORREA","nation":"FRA","horse":"AMILTON DE L'ABBAYE","results":{"entryRank":"12","fencePen1":"4","timePen1":"1","totalPen1":"5","time1":"84.83","fencePen2":"","timePen2":"1","totalPen2":"","time2":"","totalTime":"84.83","totalPen":"5" }},{"order":5,"hnb":1,"rider":"Olivier ROBERT","nation":"FRA","horse":"VADROUILLE D'AVRIL","results":{"entryRank":"1","fencePen1":"0","timePen1":"0","totalPen1":"0","time1":"78.04","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"78.04","totalPen":"0" }},{"order":6,"hnb":2,"rider":"Nicolas HOUZELLE","nation":"FRA","horse":"CANDY MAN","results":{"entryRank":"6","fencePen1":"0","timePen1":"1","totalPen1":"1","time1":"82.55","fencePen2":"","timePen2":"1","totalPen2":"","time2":"","totalTime":"82.55","totalPen":"1" }},{"order":7,"hnb":3,"rider":"Leona MERMILLOD BARON","nation":"FRA","horse":"CHANEL DE LA CLAYE","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"RET" }},{"order":8,"hnb":4,"rider":"Dylan RINGOT","nation":"FRA","horse":"CRONOS D'ELLE","results":{"entryRank":"13","fencePen1":"8","timePen1":"0","totalPen1":"8","time1":"74.52","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"74.52","totalPen":"8" }},{"order":9,"hnb":5,"rider":"Mathieu BILLOT","nation":"FRA","horse":"QUEL FILOU 13","results":{"entryRank":"17","fencePen1":"8","timePen1":"0","totalPen1":"8","time1":"81.06","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"81.06","totalPen":"8" }},{"order":10,"hnb":6,"rider":"Elisa MELLEC","nation":"FRA","horse":"CAPTAIN RUMEL","results":{"entryRank":"19","fencePen1":"12","timePen1":"0","totalPen1":"12","time1":"80.89","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"80.89","totalPen":"12" }},{"order":11,"hnb":7,"rider":"Clement MERNIER","nation":"FRA","horse":"AMSTRONG DE MOYON","results":{"entryRank":"14","fencePen1":"8","timePen1":"0","totalPen1":"8","time1":"77.33","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"77.33","totalPen":"8" }},{"order":12,"hnb":8,"rider":"Audrey COUDRIN","nation":"FRA","horse":"BLACK SWAN SPECIAL","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"WD" }},{"order":13,"hnb":9,"rider":"Bruno SELVA","nation":"FRA","horse":"VIF DE LA FONTAINE","results":{"entryRank":"1","fencePen1":"0","timePen1":"0","totalPen1":"0","time1":"80.63","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"80.63","totalPen":"0" }},{"order":14,"hnb":10,"rider":"Alexis GAUTIER","nation":"FRA","horse":"SIROCO DE COQUERIE","results":{"entryRank":"1","fencePen1":"0","timePen1":"0","totalPen1":"0","time1":"77.04","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"77.04","totalPen":"0" }},{"order":15,"hnb":11,"rider":"Pascal GIBOULET","nation":"FRA","horse":"AMAZONE DU MOTET","results":{"entryRank":"11","fencePen1":"4","timePen1":"0","totalPen1":"4","time1":"78.93","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"78.93","totalPen":"4" }},{"order":16,"hnb":12,"rider":"Cedric HUREL","nation":"FRA","horse":"FANTASIO FLOREVAL Z","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"RET" }},{"order":17,"hnb":13,"rider":"Patrick GUIMBAL","nation":"FRA","horse":"BAGATELLE DE GRANLIEU","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"WD" }},{"order":18,"hnb":14,"rider":"Jerome HUREL","nation":"FRA","horse":"BYRON DU TELMAN","results":{"entryRank":"1","fencePen1":"0","timePen1":"0","totalPen1":"0","time1":"79.84","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"79.84","totalPen":"0" }},{"order":19,"hnb":15,"rider":"Prune PLISSON","nation":"FRA","horse":"BLUE MAGIC DU BORGET","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"WD" }},{"order":20,"hnb":16,"rider":"David GONZALEZ HERRERA","nation":"FRA","horse":"VACKANDA DE LOJOU","results":{"entryRank":"15","fencePen1":"8","timePen1":"0","totalPen1":"8","time1":"78.28","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"78.28","totalPen":"8" }},{"order":21,"hnb":17,"rider":"Kyle TIMM","nation":"FRA","horse":"CRAPULE VERDOSO","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"0" }},{"order":22,"hnb":18,"rider":"Valentine HUSSON","nation":"FRA","horse":"KIEKEBOE VH KRIEKENHOF","results":{"entryRank":"18","fencePen1":"12","timePen1":"0","totalPen1":"12","time1":"75.69","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"75.69","totalPen":"12" }},{"order":23,"hnb":19,"rider":"Gaetan POIDVIN","nation":"FRA","horse":"CANITO DU MO","results":{"entryRank":"20","fencePen1":"16","timePen1":"1","totalPen1":"17","time1":"82.91","fencePen2":"","timePen2":"1","totalPen2":"","time2":"","totalTime":"82.91","totalPen":"17" }},{"order":24,"hnb":20,"rider":"Julia DALLAMANO","nation":"FRA","horse":"VARENNES DU BREUIL","results":{"entryRank":"9","fencePen1":"4","timePen1":"0","totalPen1":"4","time1":"78.24","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"78.24","totalPen":"4" }},{"order":25,"hnb":21,"rider":"Max THIROUIN","nation":"FRA","horse":"UTOPIE VILLELONGUE","results":{"entryRank":"7","fencePen1":"4","timePen1":"0","totalPen1":"4","time1":"72.89","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"72.89","totalPen":"4" }},{"order":26,"hnb":22,"rider":"Claire FONTANEL","nation":"FRA","horse":"VOL DE NUIT BATILLY","results":{"entryRank":"8","fencePen1":"4","timePen1":"0","totalPen1":"4","time1":"78.08","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"78.08","totalPen":"4" }},{"order":27,"hnb":23,"rider":"Olivier ROBERT","nation":"FRA","horse":"CARECA LS ELITE","results":{"entryRank":"10","fencePen1":"4","timePen1":"0","totalPen1":"4","time1":"78.3","fencePen2":"","timePen2":"0","totalPen2":"","time2":"","totalTime":"78.30","totalPen":"4" }},{"order":28,"hnb":24,"rider":"Nicolas HOUZELLE","nation":"FRA","horse":"CRAZY GIRL DES LOTUS","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"0" }},{"order":29,"hnb":25,"rider":"Leona MERMILLOD BARON","nation":"FRA","horse":"CESAR DU TERROIR","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"WD" }},{"order":30,"hnb":26,"rider":"Dylan RINGOT","nation":"FRA","horse":"VIVLAVIE UNE PRINCE","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"0" }},{"order":31,"hnb":27,"rider":"Mathieu BILLOT","nation":"FRA","horse":"LORD DE MUZE","results":{"entryRank":"","fencePen1":"","timePen1":"","totalPen1":"","time1":"","fencePen2":"","timePen2":"","totalPen2":"","time2":"","totalTime":"","totalPen":"0" }} Code:
    1. },"topic":"dh-arena-364"}}]

  21. #21

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

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.5 BETA

    Hi martin,
    Looking through the code as to what could be the problem I just realized there is a major bug in the loop that sends data chunks. the code is taking chunks off the end of the data instead of the beginning. major woops!
    Ill post an update this weekend.

    regrds,
    Lewis

  22. #22
    New Member
    Join Date
    Mar 2022
    Posts
    4

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.5 BETA

    Quote Originally Posted by vbLewis View Post
    Hi martin,
    Looking through the code as to what could be the problem I just realized there is a major bug in the loop that sends data chunks. the code is taking chunks off the end of the data instead of the beginning. major woops!
    Ill post an update this weekend.

    regrds,
    Lewis
    Super ! Many many thanks !

  23. #23

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

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.5 BETA

    Quote Originally Posted by martincarlos77 View Post
    Hi Many thanks for that control !
    I'm using it with a nodejs sever and sending it json string.
    When the json is not too large, everything works perfectly. When my json is larger, the server crash with a 1002 error. Do you have an idea ?

    Here is an exemple of the json that fails.

    Many thanks for your help !
    Dear Martin,
    I have posted an update, let me know if this fixes your problem!

    regards,
    Lewis

  24. #24
    New Member
    Join Date
    Mar 2022
    Posts
    4

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.5 BETA

    Quote Originally Posted by vbLewis View Post
    Dear Martin,
    I have posted an update, let me know if this fixes your problem!

    regards,
    Lewis


    Hi Lewis,

    Thanks for your answer, I still have the problem. I have attached you a txt file with 2 json : one is working and not the other.
    Server to test : ws://207.154.217.4:3001

    Thanks for your help !

    Martin

    example.txt
    Last edited by martincarlos77; Mar 21st, 2022 at 02:31 PM.

  25. #25

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

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.5 BETA

    Quote Originally Posted by martincarlos77 View Post
    Hi Lewis,

    Thanks for your answer, I still have the problem. I have attached you a txt file with 2 json : one is working and not the other.
    Server to test : ws://207.154.217.4:3001

    Thanks for your help !

    Martin

    example.txt


    Hi Martin, I believe I have fixed the problem. thanks for the test server that was a tremendous help in solving the bug.
    Please let me know if you still encounter errors.

    Thank you so much for your feed back and bug report!

    Regards,
    Lewis

  26. #26
    New Member
    Join Date
    Mar 2022
    Posts
    4

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.5 BETA

    Quote Originally Posted by vbLewis View Post
    Hi Martin, I believe I have fixed the problem. thanks for the test server that was a tremendous help in solving the bug.
    Please let me know if you still encounter errors.

    Thank you so much for your feed back and bug report!

    Regards,
    Lewis
    Hi Lewis,
    It seems to be perfect !
    I'll test it during the week-end and let you know if I have any extra problem.
    Many thanks again !
    Martin

  27. #27
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.7 BETA

    Quote Originally Posted by vbLewis View Post
    Greetings Friends,

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

    Attachment 182328

    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.7 BETA - 3/23/2022
    1) Fixed a major bug in send function having to do with fragmented frames


    UPDATE Version 1.6 BETA - 3/19/2022
    1) Fixed a major bug in sending code where data was larger than 4kb
    2) fix an error in the reconnect function related to a copy paste bug
    3) fixed a bug in the raisedata function related to decompression
    4) renamed some variables for better clarity


    UPDATE Version 1.5 BETA - 10/23/2021

    Notes: This is a huge update to the internal buffer handling. The previous buffer handling strategy became so complex it was getting hard to follow (and i coded it!).
    So after much thought i came up with a new much simpler and actually better strategy.
    Ive actually been able to put this iteration through the paces and testing and after many days of running and handling Gigs of data without a single error, I have very high confidence in this new buffer handling scheme.

    Also fixed the bug with only using TLS 1.3.

    This will probably be (fore-going any major unforeseen bugs) the last update for a while as Im very busy with other things.
    As usual I frequently check this forum so if you have any problems, issues, bugs, with this update let me know below.


    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.
    How to concatenate a service address in this format

    ws://localhost:9010/ajaxchattest

    TEST ws://82.157.123.54:9010/ajaxchattest disconnect
    Last edited by xxdoc123; Mar 25th, 2022 at 08:51 PM.

  28. #28
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.7 BETA

    Quote Originally Posted by xxdoc123 View Post
    How to concatenate a service address in this format

    ws://localhost:9010/ajaxchattest

    TEST ws://82.157.123.54:9010/ajaxchattest disconnect
    OK

    MUST INPUT

    EXTRA HEADRD
    Origin: http://82.157.123.54


    WORKE OK

  29. #29

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

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.7 BETA

    Hi xxdoc123,

    Im glad you figured out your problem. Thank your for your feedback!
    The websocket does automatically add a "Sec-Websocket-Origin:" header but not a "Origin:" header.
    I have modified the websocket to now include a "Origin:" header, if one was not specified by the user.
    I'll include in the next update...

    regards,
    Lewis

  30. #30
    Member
    Join Date
    Oct 2020
    Posts
    53

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.7 BETA

    Quote Originally Posted by vbLewis View Post
    Greetings Friends,

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

    Attachment 182328

    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.7 BETA - 3/23/2022
    1) Fixed a major bug in send function having to do with fragmented frames


    UPDATE Version 1.6 BETA - 3/19/2022
    1) Fixed a major bug in sending code where data was larger than 4kb
    2) fix an error in the reconnect function related to a copy paste bug
    3) fixed a bug in the raisedata function related to decompression
    4) renamed some variables for better clarity


    UPDATE Version 1.5 BETA - 10/23/2021

    Notes: This is a huge update to the internal buffer handling. The previous buffer handling strategy became so complex it was getting hard to follow (and i coded it!).
    So after much thought i came up with a new much simpler and actually better strategy.
    Ive actually been able to put this iteration through the paces and testing and after many days of running and handling Gigs of data without a single error, I have very high confidence in this new buffer handling scheme.

    Also fixed the bug with only using TLS 1.3.

    This will probably be (fore-going any major unforeseen bugs) the last update for a while as Im very busy with other things.
    As usual I frequently check this forum so if you have any problems, issues, bugs, with this update let me know below.


    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.
    Excellent contribution, I love how the wss vb6 project has evolved. I was the one who put it together with the help of wqweto and ur1986. It was a great achievement. This is the repository of the first project https://github.com/Maatooh/TlsSocketWSS-vb6

    Good job with the updates.

  31. #31

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

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.7 BETA

    Quote Originally Posted by Maatooh View Post
    Excellent contribution, I love how the wss vb6 project has evolved. I was the one who put it together with the help of wqweto and ur1986. It was a great achievement. This is the repository of the first project https://github.com/Maatooh/TlsSocketWSS-vb6

    Good job with the updates.
    Hi Maatooh,

    thanks for the kind words. I wasnt aware of your project, guess now i cant claim to be the first vb6 wss anymore I will have to change it to first userControl

    regards,
    Lewis

  32. #32
    New Member
    Join Date
    Jun 2019
    Posts
    12

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.9 BETA

    @vbLewis

    Thumbs up for this impressive effort.

    Can we use this OCX to implement realtime messaging between "non-server" clients?
    Can you provide samples for chat application?

    Many thanks

  33. #33

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

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.9 BETA

    Quote Originally Posted by mohmag View Post
    @vbLewis

    Thumbs up for this impressive effort.

    Can we use this OCX to implement realtime messaging between "non-server" clients?
    Can you provide samples for chat application?

    Many thanks
    No, you have to have a server to coordinate messages to and from websocket clients. I believe that is what piesocket(dot)com actually does, it allows you to connect multiple clients to their server and all subscribe to the same channel. Any messages sent by a client will be seen by (aka broadcast to) all clients. I will see if i can make a multi client demo for piesocket... but that might require a full blown json parser which I didnt want to include in the source if I didnt have to, but I will look into it.

    Regards,
    lewis

    EDIT: I have updated the example on how to implement multiple chat clients using piesocket. Its a similar process with any chat server.
    Last edited by vbLewis; Apr 10th, 2022 at 01:27 PM.

  34. #34
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.9 BETA

    Quote Originally Posted by vbLewis View Post
    No, you have to have a server to coordinate messages to and from websocket clients. I believe that is what piesocket(dot)com actually does, it allows you to connect multiple clients to their server and all subscribe to the same channel. Any messages sent by a client will be seen by (aka broadcast to) all clients. I will see if i can make a multi client demo for piesocket... but that might require a full blown json parser which I didnt want to include in the source if I didnt have to, but I will look into it.

    Regards,
    lewis

    EDIT: I have updated the example on how to implement multiple chat clients using piesocket. Its a similar process with any chat server.
    missing frmPieSocket and cZipArchive.cls

  35. #35

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

    Re: [VB6] Visual Basic 6 Client Websocket Control 1.9 BETA

    Quote Originally Posted by xxdoc123 View Post
    missing frmPieSocket and cZipArchive.cls
    Ok, sorry about that, not sure how that happened. I have re-uploaded.

  36. #36
    New Member
    Join Date
    Jul 2022
    Posts
    2

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

    https:wss://localhost:5000
    connect normal


    wss://localhost:5000/hostprotocol
    riceve :

    Error! 1016: Event Type: Recieve/Read -2147221504: Description: The revocation status of the certificate or one of the certificates in the certificate chain is unknown

    how can i solve

    thank you

  37. #37
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

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

    Most probably a problem in underlying VbAsyncSocket fixed recently in commit 793ff42 - Fix a latent heisenbug in OCSP handling.

    This random problem appears only in compiled binaries because it stems from a bug in the VB6 compiler itself.

    cheers,
    </wqw>

  38. #38
    New Member
    Join Date
    Jul 2022
    Posts
    2

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

    Quote Originally Posted by wqweto View Post
    Most probably a problem in underlying VbAsyncSocket fixed recently in commit 793ff42 - Fix a latent heisenbug in OCSP handling.

    This random problem appears only in compiled binaries because it stems from a bug in the VB6 compiler itself.

    cheers,
    </wqw>

    I tried without compiling even with the previous version (1.5), it gives me the same error

  39. #39
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,289

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

    When a compiled version not run exactly as the interpreted one then check for missing types in parameters. I have found it before some years that a not declared "as long" in function paramater signature turn to variant type which works good using interpreter but not using compiler (can't passed by reference).

  40. #40
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

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

    Quote Originally Posted by shado View Post
    I tried without compiling even with the previous version (1.5), it gives me the same error
    Is this an XP you are testing on or some other version of the OS?

    Quote Originally Posted by georgekar View Post
    When a compiled version not run exactly as the interpreted one then check for missing types in parameters. I have found it before some years that a not declared "as long" in function paramater signature turn to variant type which works good using interpreter but not using compiler (can't passed by reference).
    I'm using DefObj A-Z on all my modules incl. all modules of VbAsyncSocket so missing types in parameters default to As Object (not As Variant) and as a result cannot even compile in the IDE.

    cheers,
    </wqw>

Page 1 of 2 12 LastLast

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