Socket Ids are unstable in the room - websocket

When the clients join the room initially for a few seconds they can able to talk but after a few seconds client 1 socket id suddenly drops out from the room and getting new socket id.
After that suddenly there is a drop of the socket id of the second client and coming up with the new id.
Because of this, there is instability in the room clients are unable to communicate in the application.
We are using socket.io adapter 5.4.0v to resolve this could anyone help on this?
0|www | email: 'abc#xyz.com' }
0|www | kq0ITfQLn9ODSEGpAAAB abc#xyz.com 61155233238
0|www | kq0ITfQLn9ODSEGpAAAB joined
0|www | group event =={"_id":"5fdc4e4666849568334b6192","name":"krishna","email":"abc#xyz.com","password":"3f133f00aa4fcf85d3a15f97d6630e7b46167c45","verification_code":656137,"verification_code_expiry":"2020-12-18T06:52:58.000Z","signup_type":"general","meeting_id":"2774581974","meeting_password":"8iysCL","user_type_id":2,"status":"Active","created_by":null,"created_on":"2020-12-18T06:37:58.000Z","updated_by":null,"updated_on":"2020-12-18T06:38:23.000Z"}
0|www | [ 'kq0ITfQLn9ODSEGpAAAB' ]
0|www | zVS1eE07hmUAUDazAAAC abcd#gmail.com 6115521238
0|www | zVS1eE07hmUAUDazAAAC joined
0|www | l2T0nntZ_AsP5NGmAAAD qqweerrttyy#qqwerty.com 6115521238
0|www | l2T0nntZ_AsP5NGmAAAD joined
0|www | group event =={"participantName":"Krishna","meetingID":"6115521238","message":"hello\n"}
0|www | [ 'kq0ITfQLn9ODSEGpAAAB', 'l2T0nntZ_AsP5NGmAAAD' ]
0|www | group event =={"participantName":"qqqqq","meetingID":"6115521238","message":"E\n"}
0|www | [ 'kq0ITfQLn9ODSEGpAAAB', 'WV0qlEBEvrn0AhmiAAAE' ]
0|www | Personal event ==
0|www | [ 'kq0ITfQLn9ODSEGpAAAB', 'WV0qlEBEvrn0AhmiAAAE' ]
0|www | [ 'kq0ITfQLn9ODSEGpAAAB', 'WV0qlEBEvrn0AhmiAAAE' ]
0|www | [ 'kq0ITfQLn9ODSEGpAAAB' ]

Related

Unique counts in a callback

I have a list of users, and I'm trying to get the result of each unique domain in users' email addresses and their totals.
So, let's say I have these 5 users:
+--------------------------------------+--------------------------------+-------------+------------+-------------+
| id | email | firstname | lastname | something |
+--------------------------------------+--------------------------------+-------------+------------+-------------+
| 00c0f0db-87d0-45b2-8ed2-aa94d1e3e659 | shane.conte#jourrapide.com | Shane | Conte | iew9anap0L |
+--------------------------------------+--------------------------------+-------------+------------+-------------+
| 0114360a-3ef8-49d6-8c51-02392bc51e10 | michelle.guitierrez#dayrep.com | Michelle | Guitierrez | eeNgiev3foh |
+--------------------------------------+--------------------------------+-------------+------------+-------------+
| 00e8e2f2-2130-4f65-8914-b93d5b029d75 | terri.hebert#rhyta.com | Terri | Hebert | vahMoKiuCh0 |
+--------------------------------------+--------------------------------+-------------+------------+-------------+
| 00e1578b-cf6d-46b8-92e3-2388a80105f7 | richard.copeland#dayrep.com | Richard | Copeland | Iem4mohng |
+--------------------------------------+--------------------------------+-------------+------------+-------------+
| 00f1be34-d60e-4b2f-b3ae-610c67151f2d | elsie.fuhrman#rhyta.com | Elsie | Fuhrman | aPie6piD6ae |
+--------------------------------------+--------------------------------+-------------+------------+-------------+
After running the query, I'd like to see this result:
+-------+----------------+
| count | domain |
+-------+----------------+
| 1 | jourrapide.com |
+-------+----------------+
| 2 | dayrep.com |
+-------+----------------+
| 2 | rhyta.com |
+-------+----------------+
I'm currently running this query below to get the unique domains but if I try to run count() in it, it dramatically fails after 300 seconds, which I expect to happen since I have A LOT more than 5 users :)
r.db('helloworld').table('users').pluck('email').map(function(user) {
return user('email').split('#').nth(1).downcase()
}).distinct().map(function(domain) {
return {
count: '???', // <--- this is where I need help
domain: domain
}
})
And as you can imagine, it perfectly returns this result:
+-------+----------------+
| count | domain |
+-------+----------------+
| ??? | jourrapide.com |
+-------+----------------+
| ??? | dayrep.com |
+-------+----------------+
| ??? | rhyta.com |
+-------+----------------+
I hope this makes sense. If you think I'm on a wrong path, feel free to suggest any other way.
Thanks in advance!
You can't distinct() to count(). Instead you want to group():
r.db('helloworld').table('users').pluck('email').map(function(user) {
// wrap the result in an object for grouping purposes
return { domain: user('email').split('#').nth(1).downcase() };
})
// this groups all domains together in a [{ group, reduction }] list of objects
.group('domain')
// after group(), calls are scoped to each reduction: count each one
.count()
// let's ungroup to scope the following calls to the whole sequence
.ungroup()
// let's be compliant with the format you expect
.map(function(doc) {
return {
domain: doc('group'),
count: doc('reduction')
};
});

Undefined binding(s) detected when compiling SELECT query

I am following a tutorial for strapi and am stuck at a part where I query for dishes belonging to a restaurant. I'm sure everything is set up properly with a one(restaurant) to many(dishes) relationship defined but the query doesn't work. I've traced it to the actual query which is:
query {
restaurant(id: "1") {
id
name
dishes {
name
description
}
}
}
which returns an error when I run it in playground. The query doesn't show any issues while I write it and doesn't allow me to write anything like:
query {
restaurant(where:{id: "1"}) {
id
name
dishes {
name
description
}
}
}
My database is mysql and the two tables look like this:
mysql> describe dishes;
+-------------+---------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------+------+-----+-------------------+-----------------------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(255) | YES | MUL | NULL | |
| description | longtext | YES | | NULL | |
| price | decimal(10,2) | YES | | NULL | |
| restaurant | int(11) | YES | | NULL | |
| created_at | timestamp | NO | | CURRENT_TIMESTAMP | |
| updated_at | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+-------------+---------------+------+-----+-------------------+-----------------------------+
7 rows in set (0.00 sec)
mysql> describe restaurants;
+-------------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+-------------------+-----------------------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(255) | YES | MUL | NULL | |
| description | longtext | YES | | NULL | |
| created_at | timestamp | NO | | CURRENT_TIMESTAMP | |
| updated_at | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+-------------+--------------+------+-----+-------------------+-----------------------------+
5 rows in set (0.00 sec)
These tables where auto generated by strapi.
The full error in playground is this:
{
"errors": [
{
"message": "Undefined binding(s) detected when compiling SELECT query: select `restaurants`.* from `restaurants` where `restaurants`.`id` = ? limit ?",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"restaurant"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"Error: Undefined binding(s) detected when compiling SELECT query: select `restaurants`.* from `restaurants` where `restaurants`.`id` = ? limit ?",
" at QueryCompiler_MySQL.toSQL (/Users/redqueen/development/deliveroo/server/node_modules/knex/lib/query/compiler.js:85:13)",
" at Builder.toSQL (/Users/redqueen/development/deliveroo/server/node_modules/knex/lib/query/builder.js:72:44)",
" at /Users/redqueen/development/deliveroo/server/node_modules/knex/lib/runner.js:37:34",
"From previous event:",
" at Runner.run (/Users/redqueen/development/deliveroo/server/node_modules/knex/lib/runner.js:33:30)",
" at Builder.Target.then (/Users/redqueen/development/deliveroo/server/node_modules/knex/lib/interface.js:23:43)",
" at runCallback (timers.js:705:18)",
" at tryOnImmediate (timers.js:676:5)",
" at processImmediate (timers.js:658:5)",
" at process.topLevelDomainCallback (domain.js:120:23)"
]
}
}
}
],
"data":
Any idea why this is happening?
It seems this was a bug with the alpha.v20 and alpha.v21 versions of strapi. A bug fix has been published to solve it, an issue thread on github is here.

Oracle SELECT Subquery

I have two tables. One for transaction list and one for reference
Transaction:
ID | Agency ID | Advertiser ID | Code
1 | 123 | 440 | samplecode
Reference:
ID | LongName | Type
123 | Agency1 | Agency
440 | Advertiser1 | Advertiser
How can I write the SQL Subquery in Oracle such that I can include the LongName and the Type in the SELECT statement in the transaction table so that it will look like this:
ID | Agency ID | LongName | Type | Advertiser ID | LongName | Type | Code
1 | 123 | Agency1 | Agency | 440 | Advertiser1 | Advertiser | samplecode
You may join Transaction to Reference twice:
SELECT
t.ID,
t."Agency ID",
r1.LongName AS ln1,
r1.Type AS type1,
t."Advertiser ID",
r2.LongName AS ln2,
r2.Type AS type2,
t.Code
FROM Transaction t
INNER JOIN Reference r1
ON t."Agency ID" = r1.ID
INNER JOIN Reference r2
ON t."Advertiser ID" = r2.ID

Configure Logstash to create an Elasticsearch document with nested arrays

I'm indexing my PostgreSQL data for Elasticsearch using the Logstash JDBC Input Plugin. I have two tables called REQUEST and ASSIGNMENT listed below.
How can I use Logstash to index the two tables into one Elasticsearch document of type REQUEST with a nested arrays for all child ASSIGNMENT records?
Table: REQUEST
REQUEST_ID | POC
---------- | ----------------
1234 | Jon Snow
1256 | Tyrion Lannister
Table: ASSIGNMENT
ASSIGN_ID | REQUEST_ID | STATUS | CREATED
--------- | ---------- | ------- | ----------
2345 | 1234 | New | 2017-01-06
2364 | 1234 | Working | 2017-03-12
2399 | 1234 | Working | 2017-05-20
5736 | 1256 | New | 2017-06-28
This is what I want my Elasticsearch document to look like. It is a sample of the _source value of the search result:
"_source": {
"request_id": "1234",
"poc": "Jon Snow",
"assignments": [
{
"assign_id": "2345",
"status": "New",
"created": "2017-01-06"
},
{
"assign_id": "2364",
"status": "Working",
"created": "2017-03-12"
},
{
"assign_id": "2399",
"status": "Working",
"created": "2017-05-20"
}
]
}

Elasticsearch index with jdbc driver

Sorry my english is bad
I am using elasticsearch and jdbc river. I have two table with many-to-many relations. For example:
product
+---+---------------+
| id| title |
+---+---------------+
| 1 | Product One |
| 2 | Product Two |
| 3 | Product Three |
| 4 | Product Four |
| 5 | Product Five |
+---+---------------+
product_category
+------------+-------------+
| product_id | category_id |
+------------+-------------+
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 4 |
| 2 | 5 |
+------------+-------------+
category
+---+---------------+
| id| name |
+---+---------------+
| 1 | Category One |
| 2 | Category Two |
| 3 | Category Three|
| 4 | Category Four |
| 5 | Category Five |
+---+---------------+
I want to use array type.
{
"id": 1,
"name": "Product one",
"categories": {"Category One", "Category Two", "Category Three"}
},
How should I write a sql?
Use elasticsearch-jdbc structured objects with sql, no need to group_concat:
SELECT
product.id AS _id,
product.id,
title,
name AS categories
FROM product
LEFT JOIN (
SELECT *
FROM product_category
LEFT JOIN category
ON product_category.category_id = category.id
) t
ON product.id = t.product_id
Since river has been deprecated since ES v1.5, maybe run a standalone importer is better.

Resources