-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
advice on how to redirect udp multicast messages #54
Comments
Why not just listen UDP with websocat directly, without going though a pipe? Currently there's no option for adding memberships (you probably meant "multicast", not "broadcast"), but just listening UDP on localhost should be OK. First part: Second part: I'll treat this issue as a request to implement If you can somehow add membership though external means then maybe you can listen UDP port 30000 directly from websocat. |
Maybe there will be a warning for
|
If content being streamed over multicast UDP is mpegts-packed multimedia or RTP then it's better to use binary WebSocket messages ( |
Yes you are correct. These are UDP Multicast messages (not Broadcast, i've updated the title). Your two commands work flawlessly to get the job done. I have two notes:
thanks for your help with this...next up is to attempt to get this working using secure web sockets. |
Yes. It sees new source address, meaning replies wouldn't be sent to old address anymore.
Why looping or forking at all? Why not just persistently receive messages from the using the same UDP socket in socat and also send to websocat using the same UDP socket? |
without the fork or loop option, socat is closing upon receipt of a single message. |
Because of |
Another way to interconnect socat and websocat for datagram flow:
This example is unidirectional. With |
i actually got rid of the -t 0 in my commands. I know the issue is me not knowing how to use socat and hast nothing to do with websocat.
|
Maybe the real, non-workaround way is to implement Another workaround I devised just now:
Socat just sits around, not receiving any messages, just keeping igmp membership alive. |
agreed, fork=hack in my case. I am not familiar with the iptables forwarding for local traffic but I will look into it. You are essentially saying take multicast message and forward to unicast correct? here's the output of a socat that is hanging up after 2 messages. I've changed the output to STDOUT so i could see the message....I attempted to set a timeout of 60 seconds on this one (although the program only ran for 8 seconds). I see at the end it says socket1 is at EOF (but i sent ignoreeof. also I poll timed out (no data within 60.00000 seconds) but it was less than 1 second since last packet. socat -d -d -d -t 60 UDP4-RECVFROM:30000,ip-add-membership=224.223.222.221:127.0.0.1,reuseaddr,ignoreeof,keepalive STDOUT |
If you're interested in putting in the time my particular platform is 16.04 Ubuntu Linux :) |
Please try https://github.com/vi/websocat/releases/download/v1.5.0/websocat_amd64-linux-static+udp
Note that UDP socket is only opened and added to multicast group once first WebSocket client gets connected. If multiple clients are sending to the multicast group, expect warnings from Websocat each time source address switches. I'm not sure how WebSocket -> UDP multicast direction would work. New options:
|
vi, thank you. I will try this tomorrow morning! |
Sorry it has taken me so long to be able to test this. I am receiving an error "address in use". On my socat command prior, I had to use the reuseaddress option. Do you think this is related?
thanks |
Updated the relese file, added new option: |
we have a winner! it is working like a champ.
it even works with my cert using ssl
|
i'm gonna close out my question here. thank you for all of your assistance with getting my particular usage handled so quickly. I'll keep an eye out for official releases that support joining multicast groups. In the meantime i'll use your custom build you've provided. |
I am attempting to redirect broadcast UDP messages to javascript webpage clients.
My current approach is as follows as follows:
mkisofs /tmp/pipe
tail -f /tmp/pipe | websocat -t -s 10.0.0.1:1234
while true; do socat -t 0 UDP4-RECVFROM:30000,ip-add-membership=224.223.222.221:127.0.0.1,reuseaddr STDOUT >> /tmp/pipe; done
The issue I'm seeing in my java script webpage is that some messages seem to batch up and arrive in groups while others do not. Messages are JSON arriving once every 4-8 seconds.
Is there a more straight forward approach I should be using to forward the UDP messages? Any ideas on messages seeming to batch?
thanks!
The text was updated successfully, but these errors were encountered: