/lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-March/068027.html

https://github.com/whatwg/whatwg.org · HTML · 100 lines · 89 code · 4 blank · 7 comment · 0 complexity · 4a16b46bfd32052a0661e136e7d55158 MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE> [whatwg] WebSocket bufferedAmount includes overhead or not
  5. </TITLE>
  6. <LINK REL="Index" HREF="index.html" >
  7. <LINK REL="made" HREF="mailto:whatwg%40lists.whatwg.org?Subject=Re%3A%20%5Bwhatwg%5D%20WebSocket%20bufferedAmount%20includes%20overhead%20or%20not&In-Reply-To=%3Ck2i63df84f1003311557of6e198fesd792b509b8eec285%40mail.gmail.com%3E">
  8. <META NAME="robots" CONTENT="index,nofollow">
  9. <style type="text/css">
  10. pre {
  11. white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
  12. }
  13. </style>
  14. <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
  15. <LINK REL="Previous" HREF="068026.html">
  16. <LINK REL="Next" HREF="068010.html">
  17. </HEAD>
  18. <BODY BGCOLOR="#ffffff">
  19. <H1>[whatwg] WebSocket bufferedAmount includes overhead or not</H1>
  20. <!--htdig_noindex-->
  21. <B>Jonas Sicking</B>
  22. <A HREF="mailto:whatwg%40lists.whatwg.org?Subject=Re%3A%20%5Bwhatwg%5D%20WebSocket%20bufferedAmount%20includes%20overhead%20or%20not&In-Reply-To=%3Ck2i63df84f1003311557of6e198fesd792b509b8eec285%40mail.gmail.com%3E"
  23. TITLE="[whatwg] WebSocket bufferedAmount includes overhead or not">jonas at sicking.cc
  24. </A><BR>
  25. <I>Wed Mar 31 15:57:57 PDT 2010</I>
  26. <P><UL>
  27. <LI>Previous message: <A HREF="068026.html">[whatwg] WebSocket bufferedAmount includes overhead or not
  28. </A></li>
  29. <LI>Next message: <A HREF="068010.html">[whatwg] WebSocket bufferedAmount includes overhead or not
  30. </A></li>
  31. <LI> <B>Messages sorted by:</B>
  32. <a href="date.html#68027">[ date ]</a>
  33. <a href="thread.html#68027">[ thread ]</a>
  34. <a href="subject.html#68027">[ subject ]</a>
  35. <a href="author.html#68027">[ author ]</a>
  36. </LI>
  37. </UL>
  38. <HR>
  39. <!--/htdig_noindex-->
  40. <!--beginarticle-->
  41. <PRE>On Wed, Mar 31, 2010 at 3:16 PM, Boris Zbarsky &lt;<A HREF="http://lists.whatwg.org/listinfo.cgi/whatwg-whatwg.org">bzbarsky at mit.edu</A>&gt; wrote:
  42. &gt;<i> On 3/31/10 2:38 AM, Jonas Sicking wrote:
  43. </I>&gt;&gt;<i>
  44. </I>&gt;&gt;<i> I would have expected bufferedAmount to only change as a result of an
  45. </I>&gt;&gt;<i> event being posted to the main event loop. We generally try to avoid
  46. </I>&gt;&gt;<i> &quot;racy&quot; variables since people don't expect them. Consider for example
  47. </I>&gt;&gt;<i>
  48. </I>&gt;&gt;<i> if (ws.bufferedAmount&gt; &#160;X) {
  49. </I>&gt;&gt;<i> &#160; setUpSomeState();
  50. </I>&gt;&gt;<i> }
  51. </I>&gt;&gt;<i>
  52. </I>&gt;&gt;<i> try {
  53. </I>&gt;&gt;<i> &#160; doOtherThings();
  54. </I>&gt;&gt;<i> }
  55. </I>&gt;&gt;<i> finally {
  56. </I>&gt;&gt;<i> &#160; if (ws.bufferedAmount&gt; &#160;X) {
  57. </I>&gt;&gt;<i> &#160; &#160; cleanUpState();
  58. </I>&gt;&gt;<i> &#160; }
  59. </I>&gt;&gt;<i> }
  60. </I>&gt;&gt;<i>
  61. </I>&gt;&gt;<i> I'd imagine most JS developers to expect the cleanup to always happen
  62. </I>&gt;&gt;<i> if the setup did.
  63. </I>&gt;<i>
  64. </I>&gt;<i> Sure, but do they expect the cleanup to happen if the setup did not if
  65. </I>&gt;<i> doOtherThings tried to send() stuff?
  66. </I>&gt;<i>
  67. </I>&gt;<i> More to the point, is send() allowed to actually send anything when called,
  68. </I>&gt;<i> or does it have to buffer it all until the next time you get to the event
  69. </I>&gt;<i> loop?
  70. </I>
  71. I would expect that send() is allowed to start streaming data over the
  72. network as soon as it can, but only update bufferedAmount from the
  73. event loop.
  74. / Jonas
  75. </PRE>
  76. <!--endarticle-->
  77. <!--htdig_noindex-->
  78. <HR>
  79. <P><UL>
  80. <!--threads-->
  81. <LI>Previous message: <A HREF="068026.html">[whatwg] WebSocket bufferedAmount includes overhead or not
  82. </A></li>
  83. <LI>Next message: <A HREF="068010.html">[whatwg] WebSocket bufferedAmount includes overhead or not
  84. </A></li>
  85. <LI> <B>Messages sorted by:</B>
  86. <a href="date.html#68027">[ date ]</a>
  87. <a href="thread.html#68027">[ thread ]</a>
  88. <a href="subject.html#68027">[ subject ]</a>
  89. <a href="author.html#68027">[ author ]</a>
  90. </LI>
  91. </UL>
  92. <hr>
  93. <a href="http://lists.whatwg.org/listinfo.cgi/whatwg-whatwg.org">More information about the whatwg
  94. mailing list</a><br>
  95. <!--/htdig_noindex-->
  96. </body></html>