Comments (5)
You would have to convert the image to bytes, and then add those to the message. However, images usually require more bytes than you can fit into a single message, so you'd have to split it up into multiple parts, send the pieces separately, and reassemble them on the other end. This is not something that can be done simply by adding an extension method for the Message
class.
However, as I mentioned in response to your question on Discord, Riptide is built primarily for use in games, and games generally don't send images back and forth. Depending on what these images are for and what you're trying to do with them, there may be other/better ways of solving the problem. It's also possible that Riptide just isn't the best tool for the job, but there's no way of knowing unless you provide more information.
from riptide.
Hi, we are going to develop an AR APP, we already combine your Riptide with ARkit, we need to transfer image .jpg or Texture2D in unity to server for OpenCVforUnity to do some preprocess. Now we're stuck on how to transfer images from client to server.
from riptide.
You can change the MaxPayloadSize
of messages to fit more data into a single message.
However, increasing this past the default amount will make it more likely for packets to get lost (and require resending if they were sent reliably). Of course that only applies to messages you fill up beyond the default capacity, so smaller messages should remain unaffected.
Depending on the size of the images, fitting one into a single message may require increasing the MaxPayloadSize
past ~65,000 bytes, which is something I have not tested at all and may have unintended consequences, including errors/exceptions and messages not being delivered (potentially even if they were sent reliably).
Again, more information about what these images are for would be helpful. By using Riptide to send images, you're trying to use it for something that it's technically not built to do. It can of course be done, but it takes a bit of work. If the images are the primary/only type of data you'll be sending, Riptide is almost certainly not the ideal tool for the job and making it work may or may not be worth the effort.
Is your AR app a multiplayer game that also sends more "normal" kinds of game traffic? I'm assuming maybe not since you're working with computer vision, but if so, it makes more sense why you're using Riptide, but you should still ask yourself if you could use something else to grab the images (while continuing to use Riptide for the real time game traffic). If the images are (for example) profile pictures of other players, retrieving them from some sort of web server would likely be a much better idea.
Also, please pick one place (this GitHub issue or your help post on Discord) to continue this discussion, as continuing it in both places makes it more confusing and harder for others (who may have a similar question) to follow along.
from riptide.
I am not a pro at networking, but I think uploading the images on Firebase for example, which has support for iOS as well as Unity. Then pulling the resources from the server on your Unity client would be the way to go for transfering them. It also can be setup in a push configuration, such that the iPhone sends an uploaded resource's name via Riptide to the Unity client. After that, the Unity client downloads and preprocesses that resource. According to what your requirements are: real-time, etc.
from riptide.
Someone else has tried adding more than 65k bytes to a message, and they've informed me via Discord that this does in fact result in a socket exception, as you can't send more than ~65,000 bytes in a single packet.
As a result, increasing the MaxPayloadSize
is only helpful if your images are smaller than 65k bytes. If they exceed that threshold, you'll need to split them up (and reassemble them on the other end) regardless of whether or not you change the MaxPayloadSize
.
from riptide.
Related Issues (20)
- Feature Request | Simulating Fake Ping HOT 3
- Unhandled SocketException while Client with no Internet Connection tries to connect to the server. HOT 2
- Feature Request | Message.Reserve & Message.Insert methods HOT 5
- Client instance getting timed out after reconnecting
- Limit the amount of players HOT 3
- Character Selection Info HOT 1
- NullReferenceException at Riptide.Connection.ResetTimeout() HOT 2
- Feature Request | Additional MessageSendModes HOT 7
- Infinite Loop
- Server.MessageReceived dont work HOT 3
- Docs fail to display code references HOT 2
- Weird Timeout HOT 4
- Can unity client connect to console server HOT 3
- ios device as clients cannot connect a PC as server HOT 3
- TCP sending data, receiving less than added
- Not ticking/Updating while not focused HOT 1
- Feature request | Packet Flooding Countermeasures HOT 2
- Monitoring Socket Buffer Usage HOT 2
- Timeout Time For Individual Connections HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riptide.