diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 6e56ba502..e0816d0f9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -58,6 +58,17 @@ inputs: - No, it did not persist (it's an issue with one of your installed plugins, don't report here) - I cannot test this issue in safe mode (state why below) required: true + - type: input + attributes: + label: If you could not test in safe mode, please state why + description: >- + Issues caused by a third party plugin are a major cause of bugs reported here, so we really need to + rule out that a plugin is at fault here. [Safe mode](https://docs.octoprint.org/en/master/features/safemode.html) is an easy way to do that. Only skip safe mode + if your particular problem *absolutely requires* third party plugins to be enabled. "It would take + too long" is **not** a reason to skip testing in safe mode, neither is "I do not know how to + enable it" as you can find info on that [here](https://docs.octoprint.org/en/master/features/safemode.html). + + If you really *cannot* test in safe mode, leave a short explanation as to why. - type: description attributes: value: | @@ -92,10 +103,10 @@ inputs: value: >- Please also be sure to upload the following files below: - * `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. + * `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. Just attach down below as-is. * `serial.log` or the contents of your terminal tab, if applicable. Always include if unsure. **Please note that you need to enable `serial.log` first**, - see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. + see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. Just attach down below as-is. * Your browser's JavaScript console, if you are reporting a problem with the user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that. * If possible, screenshots or videos showing the problem, especially if you diff --git a/docs/jsclientlib/index.rst b/docs/jsclientlib/index.rst index 43b734769..280b3c241 100644 --- a/docs/jsclientlib/index.rst +++ b/docs/jsclientlib/index.rst @@ -40,6 +40,12 @@ because the library depends on those to be available (as ``$`` and ``_``). You c +Moreover, if you need to use the socket module, you'll need to include sockJS. You can embed it like this: + +.. code-block:: html+jinja + + + Note that all components depend on the ``base`` component to be present, so if you are only including a select number of components, make sure to at the very least include that one to be able to utilize the client. diff --git a/docs/jsclientlib/socket.rst b/docs/jsclientlib/socket.rst index 925528490..70b9bc5dc 100644 --- a/docs/jsclientlib/socket.rst +++ b/docs/jsclientlib/socket.rst @@ -64,12 +64,24 @@ Sends a message of type ``type`` with the provided ``payload`` to the server. - Note that at the time of writing, OctoPrint only supports the ``throttle`` message. See + Note that at the time of writing, OctoPrint only supports the ``throttle`` and ``auth`` messages. See also the :ref:`Push API documentation `. :param string type: Type of message to send :param object payload: Payload to send +.. js:function:: OctoPrintClient.socket.sendAuth(userId, session) + + Sends an ``auth`` message with the provided ``userId`` and ``session`` to the server. + + ``session`` is expected to be the ``session`` value retrieved + from any valid :ref:`OctoPrint.browser.login(userId,...) ` response. + + See also the :ref:`Push API documentation `. + + :param string userId: An existing OctoPrint username + :param string session: A valid session id for the provided username + .. js:function:: OctoPrintClient.socket.onRateTooLow(measured, minimum) Called by the socket client when the measured message round trip times have been lower than @@ -102,6 +114,17 @@ Instructs the server to decrease the message rate by 500ms. +Sample to setup an authed socket +================================ + +.. code-block:: javascript + + OctoPrint.socket.connect(); + OctoPrint.browser.login("myusername", "mypassword", true) + .done(function(response) { + OctoPrint.socket.sendAuth("myusername", response.session); + }); + .. _sec-jsclient-socket-throttling: Communication Throttling