Coder Social home page Coder Social logo

Comments (10)

boazsegev avatar boazsegev commented on May 16, 2024 1

Hi @moxgeek ,

Thanks for the update!

I just released the patch as part of the iodine 0.7.18 release.

Thanks for exposing the issue. Your name is now engraved into facil.io's changelog.

FYI: the GitHub master branch is the development branch. It always has the latest bug fixes... but I also break it sometimes while tinkering.

Cheers!

from plezi.

boazsegev avatar boazsegev commented on May 16, 2024

I apologize. This is a documentation issue that references an old version of iodine.

I’ll take care of it when I’m by my computer.

For now, please make sure you have the latest version of iodine installed and run iodine -? to get a list of command line options.

I recommend that you use these options to adjust any runtime options rather than hard-code these settings to your app.

Kindly,
Bo.

from plezi.

boazsegev avatar boazsegev commented on May 16, 2024

Possibly related to fix in version 0.7.17:

fixed CLI argument recognition for WebSocket message limits and HTTP header limits. Typos in the CLI argument names prevented the CLI from effecting the default values.

from plezi.

boazsegev avatar boazsegev commented on May 16, 2024

P.S.

Please notice that the Iodine::DEFAULT_SETTINGS[:max_msg] is in Kb (same as iodine -maxms ...).

For 4Mb you need 4096 Kb, which (unless I have a bug somewhere) should translate as:

bundle exec iodine -v -maxms 4096 -t 16 -w 20 -www ./public

Also, this limit is only relevant for incoming data. It's a security measure that protects the server against a malicious client sending huge amounts of data as a type of Slowloris WebSocket DoS attack.

Outgoing data is unlimited in size, although I do recommend fragmenting large data (or the client might be overwhelmed).

from plezi.

moxgeek avatar moxgeek commented on May 16, 2024

Also, this limit is only relevant for incoming data ... Outgoing data is unlimited in size

that's weird , i'm facing this problem with sending data from server to the client ...
the client receives an error when trying to get a bigger data : failed: Invalid frame header
with js and java client.

from plezi.

boazsegev avatar boazsegev commented on May 16, 2024

Hi @moxgeek

I can't recreate the issue. This is the code I used to send up to 32Mb of data (iodine version 0.7.17):

require 'iodine'

class Client
  def on_open client
    messages = []
    messages << ("a" * 16)
    messages << ("a" * 1024)
    messages << ("a" * (1024 * 1024))
    messages << ("a" * (4 * 1024 * 1024))
    messages << ("a" * (6 * 1024 * 1024))
    messages << ("a" * (32 * 1024 * 1024))
    Iodine.run_every(500, messages.length) { client.write messages.shift; client.close if messages.empty? }
  end
  
  def self.call env
   # check if this is an upgrade request.
   if(env['rack.upgrade?'.freeze] == :websocket)
     env['rack.upgrade'.freeze] = Client.new
     [200, {}, []]
   end
   # simply return the RESPONSE object, no matter what request was received.
   [200, {}, "Ok"]
  end
end

Iodine.listen url: "http://:3000", handler: Client

Iodine.threads = 1
Iodine.start

Which version of iodine are you running? Are you sending text of binary data? if text, is the text valid UTF-8 encoded (if not, the browser will complain)?

Kindly,
Bo

from plezi.

moxgeek avatar moxgeek commented on May 16, 2024

thanks for your feedback
i'am using 0.7.17 iodine
but what i'am doing is nothing to do with the example you share


class ExampleCtrl
  CHANNEL = "User"
  # HTTP
  def index
    # any String returned will be appended to the response. We return a String.
    "render"
  end


  def new
    'Should we make something new?'
  end

  # called when request is POST or PUT and params['id'] isn't defined or params[:id] == "new"
  def create

    "Hit the road jack ... no more no more no more"
  end

  # called when request is POST or PUT and params['id'] exists and isn't "new"
  def update

  end

  # Websockets
  def on_open
    userid = params['id']
    subscribe "ALL"
    subscribe CHANNEL+userid.to_s
    data = HEREISMYBIGSTRING
    puts data # i do this to verify if i have it on my memory and it's work
    puts CHANNEL+userid.to_s # i verify the channel number 
    publish CHANNEL+userid.to_s, data
  end
  def on_message(data)

    
  end

  def on_close
    userid = params['id'.freeze]
    publish CHANNEL+userid, "#{@handle} left us :-("
  end

end


Plezi.route '/getdata', ExampleCtrl

it's work fine for any message , but not big sized one ( less then 1mb)

from plezi.

boazsegev avatar boazsegev commented on May 16, 2024

Perfect, thanks! Now I can reproduce the issue.

As a temporary workaround try:

# for text messages
subscribe(CHANNEL+userid.to_s) {|ch, msg| msg.encode!("UTF-8"); write msg }
# # OR for binary messages
# subscribe(CHANNEL+userid.to_s) {|ch, msg| write msg }

This will circumvent the pub/sub WebSocket encoder where the bug is likely hiding.

I'll try to fix it in the next few days.

from plezi.

boazsegev avatar boazsegev commented on May 16, 2024

I think I found and fixed the issue.

Any chance you could install iodine from the GitHub repo and confirm that tissue is solved?

Thanks!
Bo.

from plezi.

moxgeek avatar moxgeek commented on May 16, 2024

cheers mate ! working fine .
maybe replacing gem iodine at Gemfile with
gem 'iodine' , git: 'https://github.com/boazsegev/iodine'
will be good to future users .
thanks again .

from plezi.

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.