Giter Site home page Giter Site logo

cppcomet / comet-server Goto Github PK

View Code? Open in Web Editor NEW
64.0 5.0 19.0 19.36 MB

CppComet - easy to use and fast in work.

Home Page: http://comet-server.com/

License: GNU Affero General Public License v3.0

CMake 0.74% C++ 40.96% Lex 0.19% C 10.37% Yacc 0.91% Shell 0.26% JavaScript 45.97% Dockerfile 0.05% Smarty 0.16% Jinja 0.38%
comet-server javascript-api mysql cometql-api comet websockets cppcomet

comet-server's Introduction

Gitter

CppComet

Comet server is written in C++, for storing data using MySQL.

Features

Comet technology – allows sending arbitrary messages to client through server initiative

How it fast

Report about load testing of 64,000 connections online

How it works

  • Introduction to comet technology EN and RU

Documentation and examples

Documentation in Russian and English languages

  • How to build and run EN or RU
  • CometQL API documentation EN or RU (To connect to the comet server api from any server-side language is used CometQL)
  • JavaScript API documentation EN or RU (To connect to the server from JavaScript API use file from api/CometServerApi.js )

Demo

Demo access to server API

For testing CppComet without install on vps you can use free cloud service with same api. In the all examples I will use demonstration access from comet-server.com for those who could not or were too lazy to deploy the server on their vps.

For demo access use credentials:

Login: 15
Password:lPXBFPqNg3f661JcegBY0N0dPXqUBdHXqj2cHf04PZgLHxT6z55e20ozojvMRvB8
Host: app.comet-server.ru

Example of connecting to cometQL api from console using mysql-client:

mysql -h app.comet-server.ru -u15 -plPXBFPqNg3f661JcegBY0N0dPXqUBdHXqj2cHf04PZgLHxT6z55e20ozojvMRvB8 -DCometQL_v1 --skip-ssl

Simple chat demo

Simple chat demo page Simple chat demo gif

On this gif animation you see how send message to web chat from CppComet api.

We connect to CppComet by mysql protocol and send CometQL query.

For connect to demo server use this command:

mysql -h app.comet-server.ru -u15 -plPXBFPqNg3f661JcegBY0N0dPXqUBdHXqj2cHf04PZgLHxT6z55e20ozojvMRvB8 -DCometQL_v1 --skip-ssl

For send message to demo chat use this query:

INSERT INTO pipes_messages (name, event, message)VALUES("web_MainPageChat", "", '{ "text":"My text","name":"My name"}' );

License

GNU AGPLv3

comet-server's People

Contributors

ergnuor avatar victortrapenok 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  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

comet-server's Issues

Сlustering mechanism

In this issue, i will be adding message about a process of work under clustering mechanism. If you want to get the email message when clustering will be completed then subscribe to this issue.

CometServerApi.js:824 Invalid pipe name subscription web_chat_pipe chatControl

При обновлении slave вкладки на master вкладке выходит ошибка
CometServerApi.js:824 Invalid pipe name subscription web_chat_pipe chatControl

Я так понял что слейв говорит мастеру на что ему нужно подписаться.

Добавил в _cometServerApi.prototype.subscription

console.log('subscription: ', name);

и увидел следующую картину:
при инициализации мастера:

subscription:  web_chat_pipe.msg
subscription:  answer_to_web_chat_pipe
subscription:  chatControl.clean

а после обновления слейва в мастере вот это:

subscription:  subscription
web_chat_pipe
chatControl

Invalid pipe name subscription
web_chat_pipe
chatControl

видимо слейв отдает мастеру все подписки одним текстом да еще и в урезанном виде.

MySQL connection not established Got packets out of order

I did everything as written in the instructions, but got this error.
MySQL 8
Ubuntu 20.04

Error text:
[Tag = dbLink, Level = 500] mysql_real_connect localhost: 3306 user = root
[Tag = dbLink, Level = 200] MySQL connection not established
Got packets out of order
ip = localhost: 3306 user = root password = root db_name = comet_db [errno = 1156]
[Tag = Any, Level = 200] Error: MySQL connection not established (attempt = 4)

Debian package

For simple deploy as non-changeable binary need Debian package instead docker/make.

_cometServerApi.prototype.send_msg("pipe_log\n"+pipe_name+"\n"+marker+"\n");

На новой версии CometServerApi.js перестает работать subscription из-за
_cometServerApi.prototype.send_msg("pipe_log\n"+pipe_name+"\n"+marker+"\n");

Судя по коду marker не инициализируется если callBack не задан

возврат к старой версии _cometServerApi.prototype.send_msg("pipe_log\n"+pipe_name+"\n"+_cometServerApi.prototype.custom_id+"\n"); решает проблему

Improve startup scripts

Improve startup scripts for right installation CppComet after building.
At this time installation not work, and service must be started only from build directory.

cmake syntax error

yacc: e - line 112 of "src/CometQL.y", syntax error
%lex-param { void* qInfo }

tabSignal.connect is not a function

Ошибка "tabSignal.connect is not a function" выходит только на Опере (хотя может и еще где), в Хроме и Фаере ее нету.

Анализ показал что tabSignal.connect undefined для Оперы

make error

root@v42471: /comet-server# make
[ 2%] Building CXX object CMakeFiles/cppcomet.dir/src/main.cpp.o
In file included from /root/comet-server/dependencies/jwt-cpp/src/include/jwt/claimvalidator.h:26:0,
from /root/comet-server/dependencies/jwt-cpp/src/include/jwt/jwt.h:31,
from /root/comet-server/dependencies/jwt-cpp/src/include/jwt/jwt_all.h:26,
from /root/comet-server/src/internalApi.h:20,
from /root/comet-server/src/user_index.h:27,
from /root/comet-server/src/devManager.h:11,
from /root/comet-server/src/main.cpp:17:
/root/comet-server/dependencies/jwt-cpp/src/include/jwt/json.hpp: In function ‘bool nlohmann::operator<(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_reference, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::const_reference)’:
/root/comet-server/dependencies/jwt-cpp/src/include/jwt/json.hpp:5704:50: error: wrong number of template arguments (1, should be 2)
return *lhs.m_value.array < *rhs.m_value.array;
^~~~~
In file included from /usr/include/c++/7/tuple:39:0,
from /usr/include/c++/7/bits/stl_map.h:63,
from /usr/include/c++/7/map:61,
from /root/comet-server/src/TagTimer.h:8,
from /root/comet-server/src/main.h:131,
from /root/comet-server/src/main.cpp:14:
/usr/include/c++/7/array:94:12: note: provided for ‘template<class _Tp, long unsigned int _Nm> struct std::array’
struct array
^~~~~
CMakeFiles/cppcomet.dir/build.make:158: recipe for target 'CMakeFiles/cppcomet.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/cppcomet.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cppcomet.dir/all' failed
make[1]: *** [CMakeFiles/cppcomet.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Функция приватного доступа в чат доступный пользователям только для чтения

Вопрос в том можно ли запретить (защитить общий канал) от отправки в него сообщений из вне (из JS)
Например я хочу при необходимости вывести у всех пользователей сразу сообщение "Через 15 минут сайт закрывается на техническое обслуживание. Сохраните документы с которыми работаете и выйдите из системы". Но мне нужно гарантировать что никак кроме как из моего PHP (CometQL) подобный сигнал не будет отправлен пользователям.
Сейчас насколько я понял общие каналы (без авторизации) открыты и на чтение и на запись одновременно и при желании какой нибудь хакер может отправить в него чтонибудь свое)

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.