6

I've been looking through the poco samples and documentation, but I couldn't find out how to use poco's websockets and SSL combined. I successfully connected a non-SSL websocket (based on the WebSocket class) to a server (the echoserver sample from Qt5.4, running on Ubuntu), but how to add SSL to the client eludes me. Poco's NetSSL_OpenSSL samples aren't all that helpful, because I don't need to know how to download, tweet, mail or write a time server. Also the latter is the only one that uses "SecureStreamSocket" objects at all (which is probably the class I need). But that sample just accesses the socket from the request object, it doesn't show how to create and configure one properly.

I just want an SSL websocket client to send and receive some simple messages, like "Hello World". Can anyone help me please?

I use Windows 7 64 Bit for the client's OS and Ubuntu 64 Bit on VirtualBox for the server's OS, but the server side is no problem. My poco version is 1.6.0 and I compiled it with Visual Studio 2013 Express. Also I use OpenSSL 1.0.1j.

Cheers

Alex

Alex
  • 5,159
  • 4
  • 25
  • 33
Alex
  • 1,198
  • 2
  • 12
  • 26
  • 3
    Oh, come ON! 2 downvotes just 1 minute after posting? If there's a problem with this question, just say so. Hit&run is not helpful at all. I did go through Poco's documentation, but it's just lacking in that specific case. – Alex Feb 27 '15 at 17:30
  • 1
    [Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.](http://stackoverflow.com/help/on-topic) – πάντα ῥεῖ Feb 27 '15 at 18:19
  • 3
    Really? How can a Hello World program attract opinionated answers? I mean it's not like there are all that many possibilities on how to do it. And how can asking for a tutorial attract opinionated answers if the total amount of tutorials I found until now is zero? I just want to know how to use those classes correctly and the function descriptions in the Poco docs aren't enough as they don't tell you what to do in which order and what to look out for. – Alex Feb 27 '15 at 21:05
  • Asking for code, without showing what you have tried yourself is off topic as well. – πάντα ῥεῖ Feb 27 '15 at 21:08
  • 7
    He said he's looked at the sample programs and can't figure out how to make them work. That IS what he's done. This sort of stupid gut-reaction downvoting is part of what makes SO so useless so much of the time. – Wexxor Jul 08 '15 at 04:27
  • 2
    @Wexxor I wouldn't say that it happens often, but it did happen to me a few times, because I tend to have difficult questions that look noobish. My only complaint about this is the no-comment-down-voting, because if I do something wrong I'd like to learn from it. Btw: I ended up leaving POCO after all, because the example code I created (see below) required me to have a main function, but I wanted to use POCO from inside my dll, so my main function is in C#. I ended up using IP Sockets with OpenSSL, which has its own challenges but it all worked out in the end. – Alex Jul 09 '15 at 06:38

1 Answers1

6

Look at WebSocket testcase. Use HTTPSClientSession (instead of HTTPClientSession).

Peter
  • 1,124
  • 14
  • 17
Alex
  • 5,159
  • 4
  • 25
  • 33
  • Thanks for all the help [in the POCO forum](http://pocoproject.org/forum/viewtopic.php?f=12&t=6465). I put my complete solution at the end of that thread. – Alex Mar 04 '15 at 14:10
  • They don't have websocket ssl classes? Only using client argument in the constructor of websocket will enable websocket on ssl? – abhiarora Dec 11 '19 at 15:41
  • 1
    The link above is dead, can you provide another? – Peter Feb 24 '20 at 09:16
  • 1
    Wow, I did not expect the forum to go down, unless POCO were to go down, too. Thank goodness there's archive.org. Here are [Page 1](https://web.archive.org/web/20160309165956/https://pocoproject.org/forum/viewtopic.php?f=12&t=6465) and [Page 2](https://web.archive.org/web/20160331075108/http://pocoproject.org/forum/viewtopic.php?f=12&t=6465&sid=8fd86bac340270edaaccd6d481c575e4&start=10). – Alex Jun 02 '20 at 11:30