by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Rohit Kumar S
    @rohit35109
    just to be more familiar
    Ajay.Gov
    @ajay-gov
    Great to know that you managed to run the sample apps in the repo. Web Agents are created within the Swim application once you start running the application. What gradle does is startup the java class that as the main(String[] args) method. You will see that it is in the TutorialPlane for the tutorial repo (https://github.com/swimos/tutorial/blob/master/server/src/main/java/swim/tutorial/TutorialPlane.java#L15). The web agents themselves are defined in the TutorialPlane as seen here: https://github.com/swimos/tutorial/blob/master/server/src/main/java/swim/tutorial/TutorialPlane.java#L12-L13. So the simplest thing for you to do is to add more WebAgent java classess using that pattern and keep the same method of running the application using the same gradle files
    @rohit35109 You may also refer to the cookbooks which cover the various concepts of swim. They can be found here (https://www.swimos.org/tutorials/). You can tweak the code locally for each of the cookbooks to see how it works.
    Rohit Kumar S
    @rohit35109
    Thanks, Ajay. :-D
    Vishnu Prassad
    @vishnuprasad73_twitter
    Hello, I set up a hello world app with swim. When try to send a message to the command lane from a Java Client it works well. When I try sending using Javscript client the message receives on the server but Im getting the following error.
    > Task :run
    Running Server plane...
    [/user/john] Hello, world!
    [/user/john] Surname of John is "Doe XAE"
    [/user/john] Surname of John is "{\"x\":\"y\"}"
    swim.codec.DecoderException: incomplete
            at swim.ws.WsStatusDecoder.decode(WsStatusDecoder.java:66)
            at swim.ws.WsStatusDecoder.feed(WsStatusDecoder.java:39)
            at swim.ws.WsFrameDecoder.decode(WsFrameDecoder.java:132)
            at swim.ws.WsFrameDecoder.decode(WsFrameDecoder.java:179)
            at swim.ws.WsDecoder.decodeCloseFrame(WsDecoder.java:115)
            at swim.ws.WsDecoder.decodeFrame(WsDecoder.java:94)
            at swim.ws.WsOpcodeDecoder.decode(WsOpcodeDecoder.java:38)
            at swim.ws.WsOpcodeDecoder.feed(WsOpcodeDecoder.java:32)
            at swim.io.IpSocketModem.doRead(IpSocketModem.java:164)
            at swim.io.TcpSocket.doRead(TcpSocket.java:230)
            at swim.io.StationTransport.doRead(Station.java:579)
            at swim.io.StationReader.runTask(Station.java:796)
            at swim.concurrent.TheaterTask.run(Theater.java:431)
            at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1425)
            at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
            at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
            at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
            at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
            at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
    [/user/john] Surname of John is "Hello World"
    swim.codec.DecoderException: incomplete
            at swim.ws.WsStatusDecoder.decode(WsStatusDecoder.java:66)
            at swim.ws.WsStatusDecoder.feed(WsStatusDecoder.java:39)
            at swim.ws.WsFrameDecoder.decode(WsFrameDecoder.java:132)
            at swim.ws.WsFrameDecoder.decode(WsFrameDecoder.java:179)
            at swim.ws.WsDecoder.decodeCloseFrame(WsDecoder.java:115)
            at swim.ws.WsDecoder.decodeFrame(WsDecoder.java:94)
            at swim.ws.WsOpcodeDecoder.decode(WsOpcodeDecoder.java:38)
            at swim.ws.WsOpcodeDecoder.feed(WsOpcodeDecoder.java:32)
            at swim.io.IpSocketModem.doRead(IpSocketModem.java:164)
            at swim.io.TcpSocket.doRead(TcpSocket.java:230)
            at swim.io.StationTransport.doRead(Station.java:579)
            at swim.io.StationReader.runTask(Station.java:796)
            at swim.concurrent.TheaterTask.run(Theater.java:431)
            at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1425)
            at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
            at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
            at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
            at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
            at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
    <=========----> 75% EXECUTING [5m 40s]
    > :run
    brohitbrose
    @brohitbrose
    May we see the JS client code?
    Ajay.Gov
    @ajay-gov
    @vishnuprasad73_twitter It seems that the messages you are sending are received on the server (and agent) but you do see a stacktrace on the server console? Is that right? Also are you using a swim-client from node.js to send this message?
    Vishnu Prassad
    @vishnuprasad73_twitter
    @ajay-gov yes, im seeing the above error on the server console.
    var swim = require("@swim/client");
    var structure = require("@swim/structure");
    
    var msg = structure.Text.from('Hello World')
    const hostRef = swim.hostRef("warp://localhost:9001");
    
    const client = new swim.WarpClient();
    client.command("warp://localhost:9001", "/user/john", "getSurname", msg);
    this is the sample client im using
    Vishnu Prassad
    @vishnuprasad73_twitter
    I also tried with java client, that worked well without any issue though
    Ajay.Gov
    @ajay-gov
    @vishnuprasad73_twitter so the exception doesn't affect the functionality?
    Vishnu Prassad
    @vishnuprasad73_twitter
    Yeah. it doesnt affect functionality. I can see the received msg on the console. Trying to figure out what causing the exception when i try with nodejs client. Am I missing anything in the node code?
    @ajay-gov
    Ajay.Gov
    @ajay-gov
    your code looks good. I think this is due to the web-socket lib that comes with node, will confirm this.
    Vishnu Prassad
    @vishnuprasad73_twitter
    cool. the exception comes right after the message received and logged.
    [/user/john] Surname of John is "Hello World"
    swim.codec.DecoderException: incomplete
    Ajay.Gov
    @ajay-gov
    it's related to the websocket close frame i think.
    will let you know, thanks for pointing this out
    Ajay.Gov
    @ajay-gov
    you could use that js code in an html page and run it from a browser, think you won't see the exceptions then.
    Vishnu Prassad
    @vishnuprasad73_twitter
    Cool. Let me try that.
    Ajay.Gov
    @ajay-gov
    @vishnuprasad73_twitter is the node ws library(https://www.npmjs.com/package/ws) one of the dependencies in your node application? If so can you try without having that as a dependency?
    Vishnu Prassad
    @vishnuprasad73_twitter
    @ajay-gov I don't use the WS library in the client app. My whole node client is the 8 lines of code i mentioned above. But i can see ws library inside node_modules when i install @swim/client
    Ajay.Gov
    @ajay-gov
    oh ok, so it's that websocket library from node which the swim-client is depending on.
    Do try it from the browser when you get a chance. We will fix that issue with the swim-client and node.
    Vishnu Prassad
    @vishnuprasad73_twitter
    Sure will do and update
    Ajay.Gov
    @ajay-gov
    @vishnuprasad73_twitter thanks! Also which version of the swim-server library are you using on the server-side. You may get that from the build.gradle and gradle.properties file.
    @vishnuprasad73_twitter we fixed a similar issue in February. Please check swimos/swim#48. It is available in our latest release version of the swim-server library which is 3.10.2.
    Vishnu Prassad
    @vishnuprasad73_twitter
    @ajay-gov im using these versions
    compile group: 'org.swimos', name: 'swim-server', version: '3.10.0'
    compile group: 'org.swimos', name: 'swim-api', version: '3.10.0'
    compile group: 'org.swimos', name: 'swim-client', version: '3.10.0'
    i will try 3.10.2 and update
    @ajay-gov Just tried updating to 3.10.2 and it worked like a charm!!!
    And with that, I have successfully implemented a hello world app on SWIM :)
    Thanks a lot
    Vishnu Prassad
    @vishnuprasad73_twitter
    Btw on maven repo the latest version is 3.10.0. people might not be aware of 3.10.2
    Ajay.Gov
    @ajay-gov
    @vishnuprasad73_twitter great to know it worked!
    So we moved our namespace from ai.swim to org.swimos. org. The latest version for org.swimos should be 3.10.2 (https://mvnrepository.com/artifact/org.swimos/swim-server)
    Latest version for ai.swim is 3.10.0 (https://mvnrepository.com/artifact/ai.swim/swim-server). Going forward we will be using org.swimos.
    Vishnu Prassad
    @vishnuprasad73_twitter
    Ah Got it.
    nmehta1993
    @nmehta1993
    any one help me to setup swim
    api
    brohitbrose
    @brohitbrose
    Hi, could you please be a little more specific?
    Are you trying to get a Swim application working on your machine for the first time? Then we recommend the tutorial application on Github: https://github.com/swimos/tutorial
    If you're trying to architect Web Agents / Lanes (i.e. a Swim API) to solve a problem, then we recommend reading these cookbooks: https://www.swimos.org/tutorials/ . Or, we can help you further if you tell us your specific problem.
    Vishnu Prassad
    @vishnuprasad73_twitter
    let valueLane = client.downlinkValue()
                        .hostUri("warp://localhost:9001").nodeUri("/welcome/valueLane").laneUri("info")
                        .open();
    
    valueLane.set(structure.Text.from("YYY"));
    Once i open a connection to a valueLane how can i close it. Trying with nodejs
    i was able to send a message to value lane
    brohitbrose
    @brohitbrose
    valueLane.close(); should work from node client
    Vishnu Prassad
    @vishnuprasad73_twitter
    @brohitbrose Thanks
    Vishnu Prassad
    @vishnuprasad73_twitter
    Can someone give me a real-world example of how SWIM is faster than traditional REST APIs or apps? I want to do POC to show how SWIM is faster than traditional REST based apps.
    Ajay.Gov
    @ajay-gov
    @vishnuprasad73_twitter Swim is a stateful platform for Real-Time Applications at scale. Swim provides Stateful Services (Web Agents), Streaming (using WARP) APIs and Real-time UIs (swim UI toolkit).
    For example you can take a look at the traffic (https://github.com/swimos/traffic), here changes to the state of an intersection (red/green/yellow) is propagated from the intersection to the cloud and then to your browser within 100 milliseconds and this is done for over a hundred intersections.
    Similarly you can take a look at the traffic (https://github.com/swimos/transit), here changes to the location of buses is propagated from the bus to the cloud and then to your browser within 100 milliseconds and this is done for over 8000 buses.
    Doing this with REST would involve polling endlessly from the browser for each intersection/bus which will overload the server and the browser.
    The traffic and transit are just sample applications. We have customers that use swim in production at a much larger scale. Please look here for a brief summary of some of our customer applications- https://www.swim.ai/customers/