Closed Somi2002 closed 2 months ago
@Somi2002 Thanks for the PR!
This example is indeed broken, but this PR does not fix it - and it also changes the behavior to use a slower path for loading (via .to_json()
). Additionally, Perspective now requires DCO signoff via the -s
commit flag for all PRs.
Ergo, closing - we'll fix this in the 2.10.1 release.
Description of Issue
The Python documentation on the Perspective website provided an incorrect WebSocket example under the Tornado section. The example had a few critical issues:
table
was used instead ofserver_table
when creating a new view.view()
method was incorrectly called ontable
instead ofserver_table
.client_table
was being created withview
instead ofserver_view.to_json()
data.These errors would cause confusion for users trying to implement Perspective with Tornado WebSockets, as the provided code would not function as intended.
Solution
This pull request addresses the issues by correcting the example code. Here are the specific changes made:
const server_view = await table.view();
toconst server_view = await server_table.view();
to use the correct variable.const client_table = await worker.table(view);
toconst client_table = await worker.table(await server_view.to_json());
so it creates the client-side table with the correct data.Testing the Fix
To test the fix, I set up a local Tornado server using the corrected code and verified that the WebSocket connection was established successfully and the Perspective viewer loaded and displayed data as expected.
These corrections ensure that the example provided in the documentation is accurate and functional, thus improving the reliability of the documentation and helping prevent implementation issues for future users.