Closed rlingineni closed 4 years ago
Hi, I think your example is assuming that sockets behave kind of like socket.io where you can emit events on either side. Sadly, that isn't the case as sockets in Node are Duplex Streams which can only work with writing binary data.
I'd suggest looking into ndjson streams which will enable you to send objects between the two sides and have some sort of type
field for the message type along with whatever other data you want for your message.
What @RangerMauve said
I'm a little new to using Hyperswarm and moreover the entire space of communicating via Sockets.
I'm trying to build a simple chat application between two peers on the same machine. Super basic but just so I can try out Hyperswarm on a basic level.
I have two files that are both running the same code:
Running the program in two terminals - I can see that they have both connected to each other, but I don't see any messages being transmitted. Is there something wrong with my approach?