Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Best HTTP Released

Discussion in 'Assets and Asset Store' started by BestHTTP, Sep 11, 2013.

  1. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    If you want a plugin that supports request customization for REST, WebSocket, Socket.IO, SignalR, Server-Sent Events (and much more) out of the box, with regular updates and outstanding support from the developer, then BestHTTP is THE tool for you!

    You can visit the new demo page now: https://besthttpdemosite.azurewebsites.net/

    Check out the docs.

    Supported platforms:
    • WebGL
    • iOS, Android
    • Windows Store Apps/Windows 10/UWP
    • Windows, Mac OS X, Linux

    ALL source code included!

    Most notable HTTP features are:
    • Customize all parts of your requests:
      • Methods(GET, HEAD, POST, PUT, DELETE, PATCH)
      • Headers
      • Cookies
      • Max redirect count
      • Timeouts
    • Access all kind of data sent by the server:
      • Headers
      • Status code
      • Cookies
    • Connection pooling
    • Connection and request timeouts
    • Automatic Cookie handling
    • Great range of Proxy support (Fiddler, Charles, etc.)
    • Automatic caching, validating just like your browser
    • Set your cache size and freshness
    • gzip content encoding
    • Basic and Digest authentication
    • Multiple (url-encoded and multipart/form-data) form types
    • Automatic redirection handling
    • Upload and Download progress tracking
    • Access your data while downloading
    • You can resume downloads using Range headers
    • HTTPS
    • Customize a great range of global settings:
      • Max connection per server
      • Enable/disable cookies
      • Private 'Browsing'
      • Cookie Jar size
      • etc

    WebSocket features:
    • Full RFC compliance
    • Support for extensions:
      • Compression Extensions for WebSocket (RFC7692)
    • Easy to use, 'just works' experience

    Socket.IO features:
    • Compliance with the latest (1.x and 2.x) Socket.IO implementation
    • Automatic transport upgrade/downgrade
    • Binary data sending/receiving
    • You can plug in your favorite Json decoder

    SignalR features:
    • Works with the latest SignalR implementation
    • Easy to use API
    • Hubs
    • Support for authentication
    • Progress messages for long running jobs
    • Automatic transport upgrade/downgrade
    • You can plug in your favorite Json decoder
    SignalR Core features:
    • Supports latest SignalR Core
    • Strongly typed callbacks
    • Uses the fastest Websocket transport
    • Package includes a Header-based authenticator

    Server-Sent Events features:


    Changelog:

    1.12.4 (2019.07.30)
    • Socket.IO
      • [Bugfix] [Polling Transport] Fixed a bug where the received length is different from the byte-length of the packet and the plugin read and tried to parse the truncated packet.
    • SignalR Core
      • [Bugfix] All transport error during closing will be ignored now.
    • Websocket
      • [Bugfix] Fixed a NullReferenceException that occured when the send thread closed and other parts tried to use a disposed resource.
    1.12.3 (2019.07.17)
    • General
      • [Bugfix] Fixed a bug where the HTTPCacheService would try to use non-supported recursive locking
      • [Bugfix] WriteOnlyBufferedStream didn't call Flush on the underlying stream
    • Websocket
      • [Bugfix] Didn't use the created buffered stream
    1.12.2 (2019.06.12)
    • General
      • [Improvement] When the same content is already stored on the disk, new responses will no write it again saving cpu and disk activity
      • [Bugfix] Fixed compile errors for UWP
      • [Bugfix] Fixed a possible NullReferenceException when the server sends back no headers at all
      • [Bugfix] Read and store responses are in a write lock to avoid an error when two or more requests to the same uri are executed.
      • [Bugfix] When CookieJar.Get called before any other CookieJar.Load it throwd an error

    1.12.1 (2019.05.29)
    • General
      • [Bugfix] Callbacks didn't called when abort requested on a HTTPRequest
      • [Bugfix] ReaderWriterLockSlim of the HTTPRequest is nulled out while it later tried to use it

    1.12.0 (2019.05.28)
    • General
      • [Improvement] Part of a larger code rewrite/overhaul removed a lot of locks and added lock-free collections and/or using ReaderWriterLockSlim. These changes affect all parts of the plugin from cookies to the signalr core protocol.
      • [Bugfix] Fixed a bug in the protocol upgrade callback to do not overwrite the connection's previously set state
      • [New Feature] HTTPRequest now supports the async-await pattern when CSHARP_7_OR_LATER is declared by Unity3d
      • [Improvement] HTTPManager.TryToMinimizeTCPLatency's default value became true
      • [Improvement] HTTPManager.MaxConnectionPerServer's default value became 6
    • SignalRCore
      • [Bugfix] JSonProtocol now handles enums properly
      • [Improvement] JSonProtocol now can handle nullable types
    • Server-Sent Events
      • [New Feature] Example added
    1.11.2 (2019.04.15)
    • General
      • [New feature] HTTPManager.UserAgent field added.
      • [Bugfix] Removed doubled quotes from multipart/form-data boundary
      • [Improvement] FileConnection now uses BufferPoolMemoryStream too
      • [Improvement] Increased default HTTPManager.MaxConnectionPerServer from 4 to 6
    • WebSocket
      • [New Feature] New LastMessageReceived property to access when the last message is received from the server.
      • [Bugfix] Removed custom host header creation as the HTTPRequest already sets it properly

    1.11.1 (2019.01.31)
    • General
      • [Bugfix] Fixed compile errors when cookies and/or SignalR protocols are disabled
      • SignalR
      • [New Feature] Initial Client -> Server streaming support added

    1.11.0 (2019.01.21)
    • General
      • [New Feature] Implemented new buffer pool mechanism to reuse internal byte arrays. This is quite a large change that touches all part of the plugin, but reduces the plugin's memory garbage production very very much! (Thanks to Teemu @ Delta Cygni Labs for the base idea and code donation!)
      • [New Feature] All samples are available in a public git repo too (https://github.com/Benedicht/BestHTTP_Examples)
      • [New Feature] Added a new IIOService interface and the plugin now uses the file system through this abstraction. New IIOService implementations can be added and set to the HTTPManager.IOService field.
      • [New Feature] Initial SOCKS proxy with basic authentication support added.
      • [Improvement] All samples now placed inside a namespace
      • [Improvement] Removed Unity's WWWForm option from AddField and FormUsage.
      • [Improvement] Updated BouncyCastle to the latest version.
      • [Improvement] BouncyCastle namespaces are moved under the BestHTTP.SecureProtocol namespace, custom class (like ICertificateVerifyer) are remaining under the Org.BouncyCastle.Crypto.Tls namespace. I hope this will help in cases where other plugins are bundling BC too.
      • [Bugfix] The request will fail if the proxy-authentication is failed
      • [Bugfix] Caching headers set multiple times on redirection
    • Socket.IO
      • [Bugfix] The plugin will not try to emit an error when the error callback throws an exception.
    • SignalRCore
      • [New Feature] Added new samples
      • [Improvement] New OnRedirect event handler
      • [Bugfix] Implemented proper redirect and authentication handling.
      • [Bugfix] Now it can handle relative redirect urls.
    1.10.10 (2018.11.04)
    • General
      • [Improvement] New demo page added: https://besthttpdemosite.azurewebsites.net/
      • [Bugfix] One of HTTProxy's constructor didn't use a parameter to set the correct value
      • [Improvement] Improved connection handling and code quality for the UWP connection layer
    • WebGL
      • [New Feature] Partial cookie support added (cookies are managed by the browser, but the plugin is able to read and write them)
      • [New Feature] Read and write cookie support added
      • [New Feature] HTTPRequest has a new WithCredentials property
      • [Improvement] More requests will be 'simple' to do not require a preflight request
    • SignalRCore
      • [New Feature] Added client-sent ping messages
      • [Improvement] New example added
    • WebSockets
      • [Improvement] Increased the limit of the per-message deflate extension's minDataLengthToCompress parameter.
      • [Improvement] [WebGL] Client-side generated status code of 1006 is treated as an error now to match non-webgl behavior.

    1.10.9 (2018.07.05)
    • General
      • [Bugfix] Fixed a compile error under WebGL
      • [Improvement] HTTPRequest's GetEntityBody became public api
      • [Improvement] Added GetFormFields to HTTPRequest

    1.10.8 (2018.07.02)
    • General
      • [Improvement] Greatly reduced the TCP packets that sent out for a HTTP request
    • WebSocket
      • [Improvement] Frame downloading now isn't blocked while user code is executing on current completed frames
    • SocketIO
      • [Bugfix] Implemented a new ToInt function instead of char.GetNumericValue as this later one throws an exception under WebGL using the new 4.x runtime
    • SignalR Core
      • [Improvement] Fixed compile errors for WSA
      • [Improvement] Added HubOptions to be able to set more options
      • [Improvement] Now it's possible to skip the negotiation process and connect straigth with the (only) WebSocket protocol
      • [Bugfix] Authentication provider's PrepareRequest wasn't called on the negotiation request.

    1.10.7 (2018.06.05)
    • General
      • [Improvement] Logger will log out time infromation too
      • [Improvement] HTTPRequest will send a Content-Length header with zero value when there's no data to send
    • WebSocket
      • [Bugfix] Fixed a case where the connection reported closed unintentionally
    • SignalR Core
      • [Improvement] Added PrepareUri function to the IAuthenticationProvider interface
      • [Improvement] Added negotiation request. Negotiation result now stored in the NegotiationResult property.
      • [Improvement] Added support for 'Close' server messages
      • [Improvement] More documentation and code comments
      • [Improvement] Code cleanup
    1.10.6 (2018.05.20)
    • General
      • [Bugfix] Fixed a case where aborting a request throw and exception
    • SocketIO
      • [Bugfix] Will not send a ping packet while waiting for a pong
      • WebSocket
      • [Bugfix] OnError OnErrorDesc events not called when the websocket's State > Connecting
    • SignalRCore
      • [Improvement] New BESTHTTP_DISABLE_SIGNALR_CORE symbol to disable SignalR Core
      • [Bugfix] The SignalR Core implementation has no dependency on SignalR classes now
    1.10.4 (2018.04.15)
    • General
      • [Improvement] csproj files added to the package to genereate dlls
      • [Improvement] Improved compatibilty with other packages that are have theirs own Utility class in the root namespace.
      • [Improvement] Improved compatibility with the Experimental (.NET 4.6) runtime
      • [Improvement] Using the HTTPRequest's CustomTLSServerNameList property now it's possible to add custom SNIs
      • [Bugfix] Decompressor used during streaming will buffer up data if necessary to avoid a GZip exception.
      • [Bugfix] Removed unnecessary logging in the HTTPUpdateDelegator
      • [Bugfix] TLS SNIs will not be sent if the host is an IPv4 or IPv6 address
      • [Bugfix] Digest authentication failed with the proxy
    • WebSocket
      • [Improvement] Now it's possible to close the websocket before it connects
      • [Improvement] New State property to access the websocket's state
      • [Bugfix] [WebGL] HTTPManager.Setup() isn't called when only the WebSocket protocol is used
    • SocketIO
      • [Bugfix] proper pingTimeout implementation (thanks @carsanlop for the code!)
    • SignalR
      • [Bugfix] It will not try to reconnect after leaving Unity's play mode.
    • SignalRCore
      • [New Feature] New SignalR Core implementation for SignalRCore 1.0.0-alpha2
    1.10.3 (2017.11.11)
    • General
      • [Improvement] Added OPTIONS verb
      • [Improvement] Better compatibility with Unity 2017.2
      • [Bugfix] Boundary generated for multipart/form-data will be a truely unique value that shouldn't be found in the payload
    • WebSocket
      • [New Feature] Added new CloseAfterNoMesssage TimeSpan property to the WebSocket class. When StartPingThread is true, the plugin will check for messages and will close the connection and emit an OnError/OnErrorDesc event after the specified time. It's not available on WebGL platform!
      • [New Feature] Added Latency property. When StartPingThread is true, it will calculate the latency from the Ping-Pong message round-trip times. It's not available on WebGL platform!
    • SignalR
      • [Bugfix] Group token not sent with polling requests
    1.10.2 (2017.07.29)
    • General
      • [Bugfix] Fixed an exception when redirected

    1.10.1 (2017.07.26)
    • General
      • [New Feature] Added BESTHTTP_DISABLE_GZIP to be able to disable gzip Accept-Encoding requests
      • [Improvement] Improved compatibility when run in an Editor window
      • [Improvement] DNS query is done async with timeout (Thanks goes to chriser on the forums for the code)
      • [Bugfix] The HTTPConnection object will not close the TCP stream when the "Connection: Close" header present and the http response handler's IsClosedManually set to true.
      • [Bugfix] Fixed a compilation issue in RawJsonForm.cs when both BESTHTTP_DISABLE_SOCKETIO and BESTHTTP_DISABLE_SIGNALR are defined
      • [Bugfix] When a request's DisableChace is set to true, it will not produce a warning if caching headers added manually
      • [Bugfix] When there's no connection the CookieJar will not override saved cookies with an empty one
    • Websocket
      • [Bugfix] Fixed an issue where receive threads are not shut down resulting in an exception
    • Socket.IO
      • [Improvement] Compatibility with Socket.IO 2.0.0
    • Server-Sent Events
      • [Improvement] Added WithCredentials property to the EventSource class under WebGL
      • [Improvement] EventSource constructor will thrown a NotSupportedException under WebGL when the underlying browser isn't supports the EventSource protocol
      • [Bugfix] Subscibing to a named event (On(...)) isn't worked under WebGL

    1.10.0 (2017.05.05)
    • General
      • Removed support for Windows Phone 8
      • [New Feature] HTTPManager and HTTPRequest has a new property 'TryToMinimizeTCPLatency' to turn on/off TCP NoDelay
      • [New Feature] A new Form type 'RawJson' to send the fields added with AddField jon encoded
      • [Improvement] Added DefaultCertificationValidator to the HTTPManger
      • [Improvement] Improved compatibility with Unity 2017.1
      • [Improvement] Now the plugin capable to download files larger than 2 GB (Thanks goes to Daniel @ present4D)
      • [Bugfix] Accessing streaming assets now possible under WebGL builds
      • [Bugfix] Fixed a sneaky bug where the HTTPUpdateDelegator unloaded in builds
    • Socket.IO
      • [Improvement] Sockets now have an Id property generated the same as in the JS Socket.IO lib.
     
    Last edited: Jul 31, 2019
    umcherrel likes this.
  2. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,545
    got demo apk on the streaming?
     
  3. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi imtrobin.

    You can download the demo apk here, and you can check the code directly here.
    The interesting codes are located in the StartDownload and in the OnfragmentDownloaded functions.

    If you have any more questions feel free to ask here or at the besthttp@gmail.com email address.
     
    Last edited: Sep 15, 2013
  4. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,545
    The DownloadStreamingTestScene only plays audio? It loads fine and I hear music and when it pause, I press Play again and it crashes.
     
  5. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi imtrobin,

    That's a strange behavior, I never seen that.
    And yes, it's only plays audio, but i should remind you, it's not a production ready audio streaming code so there might be bugs and - as you experienced - crashes.
    The main purpose was to demonstrate the streaming capabilities of the plugin.

    I will try to reproduce that crash, but I'm very confident that it's not occurred in the HTTP plugin rather than in the demo code.

    Edit: Streaming audio was my only idea to demonstrate streaming using a http plugin somehow spectacularly. Downloading a file and displaying only a download indicator is boring. :)
    But if someone can suggest me a good idea that is good for a little demo, that would be welcome.
     
    Last edited: Sep 16, 2013
  6. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,545
    streaming video would be good. after all, that's the purpose of what we want to stream.
     
  7. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Yes video streaming would be better, but making a crossplatform video streaming demo would produce more obfuscated demo code, and i think the current audio streaming sample is already too complex for a lightweight demonstration.
    The MovieTexture is desktop (and i think webplayer) only. The Handheld.PlayFullScreenMovie is iOS and Android only. And I'm curious about the Windows Phone 8 support, as I'm supporting this new mobile platform too.
    Plus i don't know how these would react when they need to play from an incomplete file, as they can play only from a file or from an url(this case that would be a very bad streaming demo:)).
    In a real product there should be (native) plugins to handle the video playing per platform, but for just a demo that would be too much work.
     
  8. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,545
  9. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Well, i agree but streaming video is just one thing, the main point behind streaming is getting data before the download ends.
    • So streaming can be used for downloading larger files and resume the download if your app closed or disconnected from the internet. (Write out to disk the downloaded fragments and resume with a Range request.)
    • Or you can start processing the response for a long-polling request.
    • You can start download (a maybe larger) leaderboard and show players that already downloaded. The response can be cached on the user's device and next time this cached response can be used if the leaderboard doesn't changed.
      This can be done with a simple request. You don't need to write code to handle the caching and validation of the cache. You just need a simple download request and set up the server to send back last-modified or eTag headers and handle the cache validation.
      This way you achive better user experience, spare user and server bandwith and spare processing power on the server too.

    So while i agree that when streaming is read the first thing to come in mind is video, but with a little creativity it can be very useful in other areas too.
    And now with my plugin it can be easy too. ;)
     
  10. dede_touchten

    dede_touchten

    Joined:
    Jul 11, 2012
    Posts:
    6
    Hi, Before I buy this plugin, I just want to confirm if Best HTTP can do the following:
    • Use REST API with PUT method
    • Use REST API with DELETE method
    • Modify / add HTTP headers (just like in curl -H)
    • Change HTTP request Content-Type
    • Add HTTP POST Data (just like in curl -d)
    • Compatible with Unity 3.5.x
    • Socket.IO compatibility
    • I have an assumption that basic version will supports all the Pro features when it is released, just minus the source code?
    Thanks!
     
  11. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi avatech,

    Thank you for you interest!

    These are all supported right now.

    Unity 3.5.7 support is waiting for approval in the Asset Store, should be out this week.

    Scoket.IO is not supported now.

    Yes, your assumptions are right.

    I hope you will find the best tool for your needs!
     
  12. dede_touchten

    dede_touchten

    Joined:
    Jul 11, 2012
    Posts:
    6
    Wow, thanks for the fast reply. I'll buy this as soon as the 3.5.7 support is up!
     
  13. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi avatech,

    Thank you for your patience.

    I'm happy to announce that Best HTTP Pro is live, and the update for the Basic edition is out too.
    They both supports Unity 3.5.7.
     
  14. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    These are stuck in my head, so i added another demo scene to the collection: LeaderboardTest. The android demo updated too.
    The server side is a little Ruby code using the Sinatra framework:
    Code (csharp):
    1. get '/LeaderboardTest/:from/:count' do |f, c|
    2.     from = f.to_i
    3.     count = c.to_i
    4.  
    5.     # Set 'Expires' header to the current Time + 1 minute
    6.     headers 'Expires' => (Time.now + 60).utc.httpdate.to_s
    7.  
    8.     # Create the leaderboard stream and write out 10 player
    9.     stream do |out|
    10.         count.to_i.times do |pos|
    11.             out << "Player_Name_#{(from + pos).to_s};#{(from + count - pos) * 100}\n"
    12.  
    13.             # Here is the streaming magic. :)
    14.             sleep 0.5
    15.         end
    16.     end
    17. end
    If you open the leaderboard url there is a high chance that your browser will display the result only when all data downloaded.
    In the demo app, the leaderboard will display continuously the received players. The result will be cached, and used while it's not expires(1 min).
     
  15. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Yesterday i started to read the specification of the Basic and Digest authentication.
    The Basic is already done.
    I hope i will finish before the end of the week and i can send the update to the Asset Store.

    And if i finish these very quickly, maybe the proxy authentication will be in this update too.
     
  16. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Both type of authentication done now. Setting up a request to use authentication can be done by one easy step: setting it's Credentials property.
    An example can be seen here:
    Code (csharp):
    1. var request = new HTTPRequest(new Uri("https://httpbin.org/digest-auth/auth-int/user/passwd"), (req, resp) =>
    2.         {
    3.             if (resp.StatusCode != 401)
    4.                 Debug.Log("Authenticated");
    5.             else
    6.                 Debug.Log("NOT Authenticated");
    7.         });
    8.  
    9. request.Credentials = new Credentials("user", "passwd");
    10. request.Send();
    For proxy authentication i need to set up a proxy server to test my code, but otherwise its should be ok too.
    Last week's update still pending in the asset store, but should be out in the next one or two days, after that i will submit this update to the asset store.
     
  17. Gundoglu

    Gundoglu

    Joined:
    Sep 26, 2013
    Posts:
    2
    Bought the plugin a few days ago and it's working great.

    In our next project, however, we need to use websockets.
    I saw in the documentation that you're planning to add support for it. My question is, that when this feature will be available? Are you planning to release it in the near future?
     
  18. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi Gundoglu,

    Thank you for your kind words.

    Regarding the WebSocket support: I will start to implement it in the coming weeks, so when you will start to develop your next game it will be ready for you. :)
     
  19. Gundoglu

    Gundoglu

    Joined:
    Sep 26, 2013
    Posts:
    2
    Hey, thanks for the fast answer.

    We're still just planning what to use so you definitely have a few more weeks to add this. :)
     
  20. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    New update uploaded to the Asset Store, will be out next week:
    • [New Feature] Basic and Digest authentication support through a new Credentials property in the HTTPRequest class
    • [Improvement] More then one redirection supported for a single request
    • [Improvement] New MaxRedirects property in the HTTPRequest class
    • [Improvement] New GetFirstHeaderValue(string headerName) function in the HTTPRequest class
    • [Improvement] New optimized parsers, for now only used for parsing the authentication header
    • [Improvement] Some code cleanup
    • [Bugfix] In some cases after sending the request and not receiving any data caused a new reconnect
    • [Bugfix] Some caching proxies return with float values in Max-Age header

    A quick sample how you can use the new authentication:
    Code (csharp):
    1. var request = new HTTPRequest(new Uri("https://httpbin.org/digest-auth/auth-int/username/password"), (req, resp) =>
    2. {
    3.   if (resp.StatusCode != 401)
    4.     Debug.Log("Authentication successful");
    5.   else
    6.     Debug.Log("Authentication Failed");
    7.  
    8.   Debug.Log(resp.DataAsText);
    9. });
    10.  
    11. request.Credentials = new Credentials("username", "password");
    12. request.Send();
     
  21. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    205
    So I've been using UniWeb recently, and they had an issue where all my requests were occurring twice for some reason even though I was definitely only calling it once. Any time I would do a POST through UniWeb, it would create two entries. However, if I used Unity's WWW class, it would work properly. So it's not an issue on our server end. Also the creator doesn't appear to be responding to anything.
    Does BestHTTP do something similar with sending multiple requests?
     
  22. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi,

    I didn't know any issue like this about my plugin, but I'm always here to help and fix any bug if there is any.
     
  23. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    205
    I appreciate the insanely quick reply. I will probably purchase this within the next few minutes just because of that, haha.
     
  24. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Thank you,

    If you will find any issue, need help or you have some suggestion, don't hesitate to drop me a mail.
     
  25. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    205
    Not sure if it's stated anywhere, but what level of stripping am I allowed to use?
     
  26. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Didn't checked the stripping levels yet, but i definitely will later today.

    However Unity love to strip out the whole System.Security namespace so without a link.xml it should be a problem.
     
  27. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi KamiKaze425,

    I was able to build run the demos with all stripping level without any additional work.
     
  28. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    205
    That's fine. I already need System.Security for a cryptography thing, so I have that link.xml file. I was just making sure I could use all the stripping levels, and it appears to work fine.
    I recommend putting that in your description, it would be a major selling point.
     
  29. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Thank you for the tip.
     
    Last edited: Oct 9, 2013
  30. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi Gundoglu!

    Just wanted to let you know that I finished adding the WebSocket support to BestHTTP, currently writing the documentation.
    I hope it will be out at the end of the week.
     
  31. apprenticegc

    apprenticegc

    Joined:
    Apr 21, 2012
    Posts:
    7
    I just bought Best HTTP Pro from asset store minutes ago. But when it is imported into a blank project, I saw the error. I am using Mac Book with OS 10.9 and Unity 4.2.2f1 Pro. I try to adjust the build setting "Api Compatibility Level", neither ".Net 2.0" nor ".Net 2.0 Subset" make the error disappear. And I have been restarted Unity each time I adjust the setting. Please help.

    $Screen Shot 2013-11-08 at 2.18.43 PM.png
     
  32. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi apprenticegc,

    You need to move the Plugins folder from the Best Http Pro folder to your Assets folder.

    (This is becouse assets can be uploaded to the store only when they are in one folder. But unity loads plugins from the Assets/Plugins folder only. So this is a limitation of unity, but i hope you understand this, and I'm sorry for any inconvenience.)
     
    Last edited: Nov 8, 2013
  33. apprenticegc

    apprenticegc

    Joined:
    Apr 21, 2012
    Posts:
    7
    Thanks, the problem is solved. Don't notice the difference the location of "Plugins" folder matters. I usually put my DLLs anywhere in "Plugins" folder(s) and they do work fine. I guess there must be some rule to "Plugins", "Editor" and "Resources" which I don't quite understand. I will spend some time to research on this topic later. But anyway, thanks for replying me so quickly.
     
  34. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    WebSocket support is live now in both Basic and Pro versions.
     
  35. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    323
    I am trying to use version 1.2 with unity 4.3.0f4 but importing the package from asset store causes a internal compiler error. I am importing it to an empty project. I have Unity pro/iOS pro /Android pro The exact error is

    ---
    Internal compiler error. See the console log for more information. output was:
    Unhandled Exception: System.TypeLoadException: Could not load type 'SocketEx.TcpClient' from assembly 'TcpClientImplementation, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'.
    at (wrapper managed-to-native) System.MonoType:GetMethodsByName (string,System.Reflection.BindingFlags,bool,System.Type)
    at System.MonoType.GetMethods (BindingFlags bindingAttr) [0x00000] in <filename unknown>:0
    at Mono.CSharp.MemberCache.AddMethods (BindingFlags bf, System.Type type) [0x00000] in <filename unknown>:0
    at Mono.CSharp.MemberCache.AddMethods (System.Type type) [0x00000] in <filename unknown>:0
    at Mono.CSharp.MemberCache..ctor (IMemberContainer container) [0x00000] in <filename unknown>:0
    at Mono.CSharp.TypeHandle..ctor (System.Type type) [0x00000] in <filename unknown>:0
    at Mono.CSharp.TypeHandle.GetTypeHandle (System.Type t) [0x00000] in <filename unknown>:0
    at Mono.CSharp.TypeHandle.GetMemberCache (System.Type t) [0x00000] in <filename unknown>:0
    at Mono.CSharp.TypeManager.MemberLookup_FindMembers (System.Type t, MemberTypes mt, BindingFlags bf, System.String name, System.Boolean used_cache) [0x00000] in <filename unknown>:0
    at Mono.CSharp.TypeManager.RealMemberLookup (System.Type invocation_type, System.Type qualifier_type, System.Type queried_type, MemberTypes mt, BindingFlags original_bf, System.String name, IList almost_match) [0x00000] in <filename unknown>:0
    at Mono.CSharp.TypeManager.MemberLookup (System.Type invocation_type, System.Type qualifier_type, System.Type queried_type, MemberTypes mt, BindingFlags original_bf, System.String name, IList almost_match) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Expression.MemberLookup (Mono.CSharp.CompilerContext ctx, System.Type container_type, System.Type qualifier_type, System.Type queried_type, System.String name, MemberTypes mt, BindingFlags bf, Location loc) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Expression.MemberLookup (Mono.CSharp.CompilerContext ctx, System.Type container_type, System.Type queried_type, System.String name, MemberTypes mt, BindingFlags bf, Location loc) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Binary.ResolveUserOperator (Mono.CSharp.ResolveContext ec, System.Type l, System.Type r) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Binary.ResolveOperator (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Binary.DoResolveCore (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression left_orig, Mono.CSharp.Expression right_orig) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Binary.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Binary.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Expression.ResolveBoolean (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression e, Location loc) [0x00000] in <filename unknown>:0
    at Mono.CSharp.If.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.TryCatch.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.TryFinally.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
    at Mono.CSharp.ToplevelBlock.Resolve (Mono.CSharp.FlowBranching parent, Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md) [0x00000] in <filename unknown>:0
     
  36. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi Ryuuguu,

    You need to move the Plugins folder from the Best Http folder to your Assets folder.

    This is because assets can be uploaded to the store only when they are in one folder. But unity loads plugins from the Assets/Plugins folder only. So this is a limitation of unity, but i hope you understand this, and I'm sorry for any inconvenience.
     
  37. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    323
    Thank you for quick reply. I even knew about this I just forgot when installing.
     
  38. chirhotec

    chirhotec

    Joined:
    Mar 30, 2010
    Posts:
    47
    I'm trying to post to a https url, but whenever I do, I get a null response and the request has an exception.

    Relevant code:

    And the exception:


    Any ideas on what might be causing this problem? I saw the documentation used https examples. I'm following it pretty closely, but I didn't see anything in there that indicated I needed to do something special to send https requests.

    Right now I'm just running from within the Unity Editor, but I plan to run it from iOS, Android, and hopefully WebPlayer.
     
    Last edited: Nov 20, 2013
  39. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi chirhotec.

    Of course https is fully supported on all platforms.
    In this case its looks like the server is sending wrong data or a non https stream.
    On platforms that you listed the plugin uses mono's own implementation so i think something should be wrong on server side, but if you send to me a "working" code sample that i can test, maybe i can figure out more about this problem.
    (All private urls that i get i use them only for debugging and i delete them as soon as they are not needed any more, or i can reproduce the problem in an other way.)

    I hope we will find out a solution quickly.

     
  40. bcole_pxlplz

    bcole_pxlplz

    Joined:
    Nov 20, 2013
    Posts:
    5
    I'm having a bit of a problem getting the Websocket events hooked up with C#.
    My Code looks like this:
    Code (csharp):
    1.  
    2. private WebSocket ws;
    3.  
    4. public ConnectionManager () {
    5.  
    6.         ws = new WebSocket(new System.Uri("http://localhost:8080"));
    7.        
    8.         ws.OnOpen += this.OnWebSocketOpen;
    9.         ws.OnMessage += this.OnMessageReceived;
    10.        
    11.         ws.Open();
    12. }
    13.  
    14. private void OnWebSocketOpen(WebSocket webSocket) {
    15.     Debug.Log("I opened a web socket!");
    16. }
    17.  
    18. private void OnMessageReceived(WebSocket webSocket, string message) {
    19.     Debug.Log("Message Recieved");
    20. }
    Neither the OnWebSocketOpen and OnMessageRecieved events are not being called. I can see the initial connection being sent to the server. I feel like I must have the delegates set up incorrectly, but I'm not sure why. Could someone point me in the right direction?
     
  41. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Hi bcole_pxlplz

    There are an event that called when an error occurs, that should tell us more about what went wrong:

    Code (csharp):
    1.     ws.OnError += OnWebSocketError;
    2.  
    3.     private void OnWebSocketError(WebSocket ws, Exception ex)
    4.     {
    5.         if (ws.InternalRequest.Response != null)
    6.             Debug.LogError("Status: " + ws.InternalRequest.Response.StatusCode + " " + ws.InternalRequest.Response.Message);
    7.  
    8.         if (ex != null)
    9.             Debug.LogError(ex.ToString() + "\n\r" + ex.Message + "\n\r" + ex.StackTrace);
    10.     }
     
  42. bcole_pxlplz

    bcole_pxlplz

    Joined:
    Nov 20, 2013
    Posts:
    5
    When I instantiate WebSocket with
    Code (csharp):
    1.  new WebSocket(new System.Uri("wss://localhost:8080"));
    I get a:
    System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
    from OnWebSocketError.

    When I instantiate WebSocket with
    Code (csharp):
    1.  new WebSocket(new System.Uri("http://localhost:8080"));
    None of the delegates are called.

    I can't use wss as a protocol unfortunately (my socket server is written in php, using ratchet). Do you have any suggestions?

    edit:
    I do have the "pro" version, so I can make some changes to the WebSocket class if need be.
     
  43. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Can you try with
    Code (csharp):
    1. new WebSocket(new System.Uri("ws://localhost:8080"));
    The System.IO.IOException: The authentication or decryption has failed message thrown because ws is for the normal protocol and wss for the secure one(as http and https). On your localhost the web server is serving a non secure connection while the client trying to connect to it as a secure one("wss").

    Anyway, i will check out this Ratchet to see whether there is a problem with my implementation.
     
    Last edited: Nov 20, 2013
  44. chirhotec

    chirhotec

    Joined:
    Mar 30, 2010
    Posts:
    47
    I sent you a private message with a link to a unitypackage with the relevant files. But now my Sent Box isn't showing it. Please let me know if I should send it again.
     
  45. bcole_pxlplz

    bcole_pxlplz

    Joined:
    Nov 20, 2013
    Posts:
    5
    I tried again with new WebSocket(new System.Uri("ws://localhost:8080")) and I'm back to not getting an exception, but again, none of the delegates are being called.

    I logged the messages out of my server, and I'm getting
    Connection 28 sent message 'GET / HTTP/1.1'
    Connection 28 sent message 'Host: '
    Connection 28 sent message 'localhostUpgrade: websocketConnection: keep-alive, UpgradeSec-WebSocket-Key: gHwJqgCss33wNjO4AJtX1w==Sec-WebSocket-Version: '
    Connection 28 sent message '13Cache-Control: no-cachePragma: no-cacheAccept-Encoding: gzip, deflate, identity'
    Connection 28 sent message 'TE: chunked, identity'
    Connection 28 sent message ''


    which to me looks correct. Is the client waiting on a 'connection success' message sent from the server?
     
  46. bcole_pxlplz

    bcole_pxlplz

    Joined:
    Nov 20, 2013
    Posts:
    5
    Edit: Oops, thought chirhotec was replying to me.
     
    Last edited: Nov 20, 2013
  47. chirhotec

    chirhotec

    Joined:
    Mar 30, 2010
    Posts:
    47
    Sorry, that was for BestHTTP, from the previous page :)
     
  48. bcole_pxlplz

    bcole_pxlplz

    Joined:
    Nov 20, 2013
    Posts:
    5
    Nope, it was me. I figured out what was going on. To anyone using Ratchet: Make sure your webserver instance includes the IoServer, HttpServer, and WsServer.
     
  49. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Please try to resend it, it get lost somewhere in the wires. :)
     
  50. BestHTTP

    BestHTTP

    Joined:
    Sep 11, 2013
    Posts:
    1,316
    Im happy that is working now.