Glimpse / Home

Project Glimpse: Node Edition - Spend less time debugging and more time developing.
http://node.getglimpse.com
Other
252 stars 9 forks source link

[Request] Request doesn't update in real time for Glimpse client on Azure #40

Closed chetsangnil closed 7 years ago

chetsangnil commented 8 years ago

Requests on Glimpse Client hosted on Azure doesn't get update in real time. Please take a look into this.

nikmd23 commented 8 years ago

I suspect that this isn't actually Azure related, but @chetsangnil, is it safe to assume you're experiencing this behavior on http://strickerapp.azurewebsites.net/browse?

Also, what browser were you using?

chetsangnil commented 8 years ago

Yes and I experienced it in Chrome. No request is shown in edge.

philliphoff commented 7 years ago

Azure doesn't seem to support server-sent events (for Node.js apps) by default, which the server uses to stream new messages to the client. It can be enabled, however, by using a custom web.config file (starting with the version that's automatically generated for the app), then adding: responseBufferLimit="0" to the handler configuration for issnode. This seems to remove any response buffering Azure is doing on the app's behalf, so that the response chunks are immediately sent to the client.

E.g.

<?xml version="1.0" encoding="utf-8"?>
<!--
     This configuration file is required if iisnode is used to run node processes behind
     IIS or IIS Express.  For more information, visit:

     https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->

<configuration>
  <system.webServer>
    <!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
    <webSocket enabled="false" />
    <handlers>
      <!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
      <add name="iisnode" path="bin/www" verb="*" modules="iisnode" responseBufferLimit="0"/>
    </handlers>
    <rewrite>
      <rules>
        <!-- Do not interfere with requests for node-inspector debugging -->
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^bin/www\/debug[\/]?" />
        </rule>

        <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
        <rule name="StaticContent">
          <action type="Rewrite" url="public{REQUEST_URI}"/>
        </rule>

        <!-- All other URLs are mapped to the node.js site entry point -->
        <rule name="DynamicContent">
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
          </conditions>
          <action type="Rewrite" url="bin/www"/>
        </rule>
      </rules>
    </rewrite>

    <!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
    <security>
      <requestFiltering>
        <hiddenSegments>
          <remove segment="bin"/>
        </hiddenSegments>
      </requestFiltering>
    </security>

    <!-- Make sure error responses are left untouched -->
    <httpErrors existingResponse="PassThrough" />

    <!--
      You can control how Node is hosted within IIS using the following options:
        * watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
        * node_env: will be propagated to node as NODE_ENV environment variable
        * debuggingEnabled - controls whether the built-in debugger is enabled

      See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
    -->
    <!--<iisnode watchedFiles="web.config;*.js"/>-->
  </system.webServer>
</configuration>
philliphoff commented 7 years ago

I've added some notes about it to the Glimpse.Home README.

nikmd23 commented 7 years ago

This is now available in Glimpse for Node 0.18.9. Please see our announcement issue for more information.