Git Product home page Git Product logo

Comments (5)

tom-weiland avatar tom-weiland commented on June 8, 2024

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.

lck666666 avatar lck666666 commented on June 8, 2024

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.

tom-weiland avatar tom-weiland commented on June 8, 2024

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.

HLCaptain avatar HLCaptain commented on June 8, 2024

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.

tom-weiland avatar tom-weiland commented on June 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.