Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 08 22:03
    Abdubek closed #50
  • Feb 08 22:03
    Abdubek commented #50
  • Feb 08 21:58
    Abdubek commented #50
  • Feb 08 21:57
    Abdubek commented #50
  • Feb 08 21:51

    ai on master

    Update authentication.md (#49) (compare)

  • Feb 08 21:51
    ai closed #49
  • Feb 08 21:50
    ai commented #50
  • Feb 08 21:49
    Abdubek opened #50
  • Feb 08 21:26
    Abdubek opened #49
  • Jan 19 22:34

    ai on master

    Add loader to pure JS example (compare)

  • Jan 16 20:08

    ai on master

    Typo (compare)

  • Jan 16 17:56

    ai on master

    Improve link (compare)

  • Jan 16 17:52
    ai commented #47
  • Jan 16 17:52

    ai on master

    Clean up text Spelling check (compare)

  • Jan 16 17:49

    ai on master

    Add info about size of the clie… (compare)

  • Jan 16 17:49
    ai closed #47
  • Jan 16 16:09
    myshov commented #47
  • Jan 16 16:07
    myshov synchronize #47
  • Jan 16 16:05
    myshov synchronize #47
  • Jan 16 15:23

    ai on master

    Typo fix (#48) dispatch.crossT… (compare)

Can Rau
@CanRau
😅
Can Rau
@CanRau
hm I'm trying it, yet now it complains about window not defined in @logux/client/client.js yet all lines referencing window already check if it's not undefined 🧐
still no react native expert myself
Andrey Sitnik
@ai
send PR with a warning message from RN
I will try to help in code reviewing
Can Rau
@CanRau
👍
Can Rau
@CanRau
Can Rau
@CanRau

so after all those fixes, the metro bundler show a bunch of those

 LOG  Logux state is connecting
 LOG  Logux state is disconnected

and I get

Screenshot_20191105-143637_mobileRnTs.jpg
interesting that error seems to be related to @logux/client/log.js after disabling log(client) I get WS Error from self.emitter.emit('error', event.error || new Error('WS Error')) in @logux/core/ws-connection.js
Can Rau
@CanRau
logging the event itself yields
{
  "message": "console.error: {\"isTrusted\":false,\"message\":\"failed to connect to /192.168.0.4 (port 31337) from /192.168.2.2 (port 59372) after 10000ms\"}",
  "stack": [
    {
      "functionName": "_construct",
      "lineNumber": 30,
      "columnNumber": 26,
      "fileName": "[..]/node_modules/@babel/runtime/helpers/construct.js"
    },
    {
      "functionName": "Wrapper",
      "lineNumber": 26,
      "columnNumber": 23,
      "fileName": "[..]/node_modules/@babel/runtime/helpers/wrapNativeSuper.js"
    },
    {
      "functionName": "SyntheticError",
      "lineNumber": 25136,
      "columnNumber": 111,
      "fileName": "http://localhost:8081/index.bundle?platform=android&dev=true&minify=false"
    },
    {
      "functionName": "reactConsoleErrorHandler",
      "lineNumber": 135,
      "columnNumber": 52,
      "fileName": "[..]/node_modules/react-native/Libraries/Core/ExceptionsManager.js"
    },
    {
      "functionName": "ws.onerror",
      "lineNumber": 38,
      "columnNumber": 20,
      "fileName": "[..]/node_modules/@logux/core/ws-connection.js"
    },
    {
      "functionName": "EventTarget.prototype.dispatchEvent",
      "lineNumber": 818,
      "columnNumber": 39,
      "fileName": "[..]/node_modules/event-target-shim/dist/event-target-shim.js"
    },
    {
      "functionName": "_eventEmitter.addListener$argument_1",
      "lineNumber": 262,
      "columnNumber": 10,
      "fileName": "[..]/node_modules/react-native/Libraries/WebSocket/WebSocket.js"
    },
    {
      "functionName": "emit",
      "lineNumber": 190,
      "columnNumber": 12,
      "fileName": "[..]/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js"
    },
    {
      "functionName": "callFunctionReturnFlushedQueue",
      "lineNumber": null,
      "columnNumber": null,
      "fileName": "[native code]"
    }
  ]
}
Andrey Sitnik
@ai

@CanRau good thing: it is not the problem of Logux architecture.

Bad things, it could a WS problem, which is hard to debug and fix

  1. What do you have in the server log?
  2. Try to google react native websocket "failed to connect to"
  3. What is event class? Maybe it has some code, which we can’t see in JSON view?
Can Rau
@CanRau
okay so it seems to be kinda working, than it stops, it's kinda related to the server running on my macbook in my local network, as I said, I got it working, then some timeout error after that it stops working, after many reloads etc it works until I hit the same issues again...now I'm done for today 😅pretty exhausting haha, digging deeper into RN and Android, maybe I should get myself an iPhone somehow^^ (not sure it's any better though), so I'll keep you posted, have a good night 🖤
Can Rau
@CanRau

uhuh, setting

host: '192.168.0.4',
controlHost: '192.168.0.4',

on the server seems to work 😍

Can Rau
@CanRau
so that's the mentioned timeout error
{
  "message": "console.error: \"Error on Logux server:\n\", \"LoguxError: A timeout was reached (20000ms)\n    at FilteredNode.syncError ([..]/desktop-logux/node_modules/@logux/core/base-node.js:420:15)\n    at Timeout.<anonymous> ([..]/desktop-logux/node_modules/@logux/core/base-node.js:449:12)\n    at ontimeout (timers.js:425:11)\n    at tryOnTimeout (timers.js:289:5)\n    at listOnTimeout (timers.js:252:5)\n    at Timer.processTimers (timers.js:212:10)\"",
  "stack": [
    {
      "functionName": "_construct",
      "lineNumber": 30,
      "columnNumber": 26,
      "fileName": "[..]/mobileRnTs/node_modules/@babel/runtime/helpers/construct.js"
    },
    {
      "functionName": "Wrapper",
      "lineNumber": 26,
      "columnNumber": 23,
      "fileName": "[..]/mobileRnTs/node_modules/@babel/runtime/helpers/wrapNativeSuper.js"
    },
    {
      "functionName": "SyntheticError",
      "lineNumber": 25136,
      "columnNumber": 111,
      "fileName": "http://localhost:8081/index.bundle?platform=android&dev=true&minify=false"
    },
    {
      "functionName": "reactConsoleErrorHandler",
      "lineNumber": 135,
      "columnNumber": 52,
      "fileName": "[..]/mobileRnTs/node_modules/react-native/Libraries/Core/ExceptionsManager.js"
    },
    {
      "functionName": "node.on$argument_1",
      "lineNumber": 316,
      "columnNumber": 20,
      "fileName": "[..]/mobileRnTs/node_modules/@logux/client/client.js"
    },
    {
      "functionName": "slice.call.filter$argument_0",
      "lineNumber": 55,
      "columnNumber": 14,
      "fileName": "[..]/mobileRnTs/node_modules/nanoevents/index.js"
    },
    {
      "functionName": "filter",
      "lineNumber": null,
      "columnNumber": null,
      "fileName": "[native code]"
    },
    {
      "functionName": "slice.call.filter$argument_0",
      "lineNumber": 54,
      "columnNumber": 52,
      "fileName": "[..]/mobileRnTs/node_modules/nanoevents/index.js"
    },
    {
      "functionName": "debugMessage",
      "lineNumber": 8,
      "columnNumber": 22,
      "fileName": "[..]/mobileRnTs/node_modules/@logux/core/messages/debug.js"
    },
    {
      "functionName": "onMessage",
      "lineNumber": 393,
      "columnNumber": 33,
      "fileName": "[..]/mobileRnTs/node_modules/@logux/core/base-node.js"
    },
    {
      "functionName": "connection.on$argument_1",
      "lineNumber": 175,
      "columnNumber": 19,
      "fileName": "[..]/mobileRnTs/node_modules/@logux/core/base-node.js"
    },
    {
      "functionName": "slice.call.filter$argument_0",
      "lineNumber": 55,
      "columnNumber": 14,
      "fileName": "[..]/mobileRnTs/node_modules/nanoevents/index.js"
    },
    {
      "functionName": "filter",
      "lineNumber": null,
      "columnNumber": null,
      "fileName": "[native code]"
    },
    {
      "functionName": "slice.call.filter$argument_0",
      "lineNumber": 54,
      "columnNumber": 52,
      "fileName": "[..]/mobileRnTs/node_modules/nanoevents/index.js"
    },
    {
      "functionName": "ws.onmessage",
      "lineNumber": 57,
      "columnNumber": 24,
      "fileName": "[..]/mobileRnTs/node_modules/@logux/core/ws-connection.js"
    },
    {
      "functionName": "EventTarget.prototype.dispatchEvent",
      "lineNumber": 818,
      "columnNumber": 39,
      "fileName": "[..]/mobileRnTs/node_modules/event-target-shim/dist/event-target-shim.js"
    },
    {
      "functionName": "_eventEmitter.addListener$argument_1",
      "lineNumber": 232,
      "columnNumber": 27,
      "fileName": "[..]/mobileRnTs/node_modules/react-native/Libraries/WebSocket/WebSocket.js"
    },
    {
      "functionName": "emit",
      "lineNumber": 190,
      "columnNumber": 12,
      "fileName": "[..]/mobileRnTs/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js"
    },
    {
      "functionName": "callFunctionReturnFlushedQueue",
      "lineNumber": null,
      "columnNumber": null,
      "fileName": "[native code]"
    }
  ]
}
Andrey Sitnik
@ai
there are 2 the most popular reasons for timeout errors:
  1. Very simple broken connection without disconnect error
  2. Some environments try to pack WS events into blocks and send one block. This increase round-trip time and it could become bigger than timeout
does reconnect works? Logux should try to connect again after broken connection
Can Rau
@CanRau
didn't happen again so far, now I really need to get some sleep 😅pretty satisfying to see my logux data on mobile though 😍tomorrow I'll investigate further 🙌have a good night 😴
Neville Franks
@getclibu_twitter
@ai I'm trying to connect a Browser on one PC to the Logux Server on another PC. I'm using the IP address of the Server PC for the connection. The HTTP requests to the HTTP server works fine, however I'm getting an ERR_CONNECTION_TIMED_OUT error for the Websocket connection. The url is: "ws://192.168.0.152:31337" where 192.168.0.152 is the Logux Server's IP. The terminal running node.js + logux isn't displaying any connection request. I realize this isn't a Logux issue but thought you may have a resolution. I've been trying various things for a while now.
Andrey Sitnik
@ai
@getclibu_twitter you need to check host in server log. It should be 0.0.0.0 to allows connect from different machines (development server by default uses 127.0.0.0 which allow only local clients for security reasons).
If Host changes will help, I will add extra notes to the server log to make this behaviour more clear
Neville Franks
@getclibu_twitter
@ai Aha, that's explains a lot. Is host specified as a startup param or in new Server( Server.loadOptions(process, { subprotocol: '1.0.0', supports: '1.x', root: __dirname })
Neville Franks
@getclibu_twitter
@ai Ok I looked at the server code and use --host 0.0.0.0 and it all works now. It looks like you can also use an Environment variable.
Yes all these Server params/options need to be documented. I can't see any such docs at present.
Andrey Sitnik
@ai
@getclibu_twitter
Nikolay Govorov
@nikolay-govorov

Hi! Glad to be here)

Can anyone here use Logux with TypeScript? For this task I support my own types. If you're doing the same, maybe we can join forces?

popuguy
@popuguytheparrot
at first glance reminds json-rpc with a stuff out of the box
Zafar Ansari
@ansarizafar
Ia there a Logux client available for Goolge Flutter framework?
Andrey Sitnik
@ai
@popuguytheparrot but with a few important additions:
  1. On the client, you have a queue of “requests”. You apply them imminently to your UI and keep in the queue until you will have a connection.
  2. Each request has distributed time, so the server will know an order
  3. You requests will be re-send to other clients to update their UI state as well
  4. Server can ask you to revert some request from their UI (for instance, in case of a server error or to keep the right order)
@ansarizafar sorry, not right now. Only browser JS API with Redux bindings
trbrc
@trbrc
Hello, I just came across Logux and it looks pretty interesting. I’m trying to figure out how tied it is to Redux. Can I use it without Redux?
trbrc
@trbrc
Looks like I can use logux/client to implement any custom frontend without Redux?
Andrey Sitnik
@ai
@trbrc yes, but without Redux you will need to think how to make actions order the same on every client
For instance, client 1 added action A. In the same moment client 2 added B. A few seconds later they synchronize actions to the server (any network request has latency) and client 1 has order
A, B. But client 2: B, A.
I mean the order of calling log.on("add" event listener, which change the state. With different calling order, the state could be different
But there is a ways to solve the problems
For instance, you can use actions, which doesn't rely on the state
trbrc
@trbrc
@ai thanks, I expected to handle that anyway. It’s all the syncing and stuff that I
trbrc
@trbrc
huh, why was that sent, I never hit return 👀
Samrat Bhandari
@samratarmas
Hello team, really excited by the community! I have a quick architectural question : I don't see the mention of database anywhere in the docs. I understand that logux is database and framework agnostic, is there an example of integrating logux with a database such as clientside indexeddb? How should I proceed with such integration, say I wanted to querry data that I inserted based on parameters
@getclibu_twitter I have read about your NanoSQL logux integration in their gitter chat, so if I were to implement such integration, would I first write data to logux and then write the same data to the database? How would the two stay in sync?
Andrey Sitnik
@ai

@samratarmas great question. There are 2 ways of using a database with Logux:

  1. To store a log in database
  2. To store a state in the database.

Storing a log is the best case for client-side (if we are talking about common applications, of course, we always have edge cases). Logux already support IndexedDB for log store. Just load @logux/client/indexed-store and user it in store options of Client https://logux.io/web-api/#client

It is a god idea to create docs about using IndexedDB. Sorry, we do not have them right now. I created an issue for myself logux/docs#44

Talking about storing a state. it is mostly use case for servers. In our examples, we show how you can change DB state in server.type https://logux.io/node-api/#server-type

But it is hard to show an example of using some database since every database is very different. But Logux doesn’t require any specific things from DB. You can use DB’s guides for Node.js.

Here is our example of using Logux Server with PostgreSQL https://logux.io/guide/starting/node-server/#database

Anton
@antonkatz
Hello! I never knew that a library like logux existed. I tried to write my own a while ago with little success.
Is logux really the only one? Nothing else around?
Andrey Sitnik
@ai
@antonkatz there are a lot of distributed database
Anton
@antonkatz
the only one I know is gun.js
Andrey Sitnik
@ai
It depends what are you looking for