Git Product home page Git Product logo

qt-nats's People

Contributors

cashzero avatar dschulz avatar mczechyra avatar mjpees avatar pkoretic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qt-nats's Issues

Missing brackets

Hi, I found that You missed brackets in file natsclient.h, line 499
Now is:
while(last_pos != buffer.toUtf8.length())
should be:
while(last_pos != buffer.toUtf8().length())

Build errors with qt5.12.12 in Mac

In file included from main.cpp:3:
./../../natsclient.h:248:55: error: no member named 'errorOccurred' in 'QAbstractSocket'
QObject::connect(&m_socket, &QAbstractSocket::errorOccurred, this, [this](QAbstractSocket::SocketError socketError)
~~~~~~~~~~~~~~~~~^
./../../natsclient.h:347:56: error: no member named 'errorOccurred' in 'QAbstractSocket'
QObject::connect(&m_socket, &QAbstractSocket::errorOccurred, this, [this](QAbstractSocket::SocketError socketError)
~~~~~~~~~~~~~~~~~^
./../../natsclient.h:587:63: error: no member named 'split' in 'QStringView'
QList parts = QStringView{operation}.split(u" ", Qt::SkipEmptyParts);
~~~~~~~~~~~~~~~~~~~~~~ ^
./../../natsclient.h:587:79: error: no member named 'SkipEmptyParts' in namespace 'Qt'
QList parts = QStringView{operation}.split(u" ", Qt::SkipEmptyParts);
~~~~^
./../../natsclient.h:593:40: error: no member named 'toInt' in 'QStringView'
message_len = parts[3].toInt();
~~~~~~~~ ^
./../../natsclient.h:598:40: error: no member named 'toInt' in 'QStringView'
message_len = parts[4].toInt();
~~~~~~~~ ^
4 warnings and 6 errors generated.
make: *** [main.o] Error 1

I am newbie , How to install Qt5 in Visual Studio 2017

I try to install nl.cqm.Qt5Core on Nuget packages manager

https://www.nuget.org/packages/nl.cqm.Qt5Core/5.9.6/

but don't have file QSslConfiguration.h and QSslSocket.h in natsclient.h
#include <QSslConfiguration.h> #include <QSslSocket.h>

qt5 Cyrillic(Russian characters, letters) Client parse ERROR state=30.

Hello, I found error in client publish method (C++ qt5) when I used Russian letters. So, I also found the answer to solve it. Please, fix it in official version. I just corrected the publish method in "natsclient.h". Right way is here:

inline void Client::publish(const QString &subject, const QString &message, const QString &inbox)
{
QString body = QStringLiteral("PUB ") % subject % " " % inbox % (inbox.isEmpty() ? "" : " ") % QString::number(message.toUtf8().length()) % CLRF % message % CLRF;

    DEBUG("published:" << body);

    m_socket.write(body.toUtf8());
}

It's forgotten to set Utf8 before setting the length().
Bad way is:
QString::number(message.length())

Right is:
QString::number(message.toUtf8().length())

Fix for ambiguous Error using Qt 5.8

natsclient.h:466: Fehler: call of overloaded 'compare(const char [5], Qt::CaseSensitivity)' is ambiguous
if(operation.compare("PING", Qt::CaseInsensitive) == 0)
^

image

Question(s) & thanks

Hi,

By glancing at the sources I noticed that qt-nats has no cluster awareness like the official Synadia C client (no server list, no automatic reconnects etc).

Form nats.c, Clustered usage:

static char *servers[] = { "nats://localhost:1222",
                           "nats://localhost:1223",
                           "nats://localhost:1224"};
                           
// Setup options to include all servers in the cluster.
// We first created an options object, and pass the list of servers, specifying
// the number of servers on that list.
natsOptions_SetServers(opts, servers, 3);

// We could also set the amount to sleep between each reconnect attempt (expressed in
// milliseconds), and the number of reconnect attempts.
natsOptions_SetMaxReconnect(opts, 5);
natsOptions_SetReconnectWait(opts, 2000);

// We could also disable the randomization of the server pool
natsOptions_SetNoRandomize(opts, true);

// Setup a callback to be notified on disconnects...
natsOptions_SetDisconnectedCB(opts, disconnectedCb, NULL);

// And on reconncet
natsOptions_SetReconnectedCB(opts, reconnectedCb, NULL);

// This callback could be used to see who we are connected to on reconnect
static void
reconnectedCb(natsConnection *nc, void *closure)
{
    // Define a buffer to receive the url
    char buffer[64];

    buffer[0] = '\0';

    natsConnection_GetConnectedUrl(nc, buffer, sizeof(buffer));
    printf("Got reconnected to: %s\n", buffer);
}

This prompted me to ask:

a) How compatible is nats-qt with current nats-server versions (eg. v2.0.4) ?
b) Would @pkoretic be willing to add the missing functionality to qt-nats?

Anyway, thank you for sharing the code. Great little lib!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.