connect to websocket with proxy in Deno - websocket

I want to connect to a Websocket with a Proxy and all of that using Deno. But sadly, I cannot find any Deno module that supports that. I even looked in the Nodejs websockets module and how it's handled there. But I don't really understand the standard deno websocket module, so I can't figure out how to implement proxies. Can someone help me?
Edit:
I found this:
import { createRequire } from "https://deno.land/std/node/module.ts";
const require = createRequire(import.meta.url);
Which lets me import node modules. So i can hopefully just use the node websocket module in Deno. I will update my Question if I can get it to work.

I'm not sure if it would work for WebSockets, it's not explicitly mentioned, but Deno supports proxies via environment variables, see https://deno.land/manual#v1.25.1/linking_to_external_code/proxies
If you try it out I would be interested in knowing if it worked or not.
Something else (instead of your createRequire import) you can do since Deno version 1.25 is directly importing npm packages like this:
import * as <whatever> from 'npm:<packagename>'
although this is currently flagged as unstable and therefore requires you to run your code with --unstable.

Related

odoo.sh ver. 14 WKHTMLTOPDF 0.12.25: Unable to call host printing service (HTTPError). How to circumvent this?

We're using odoo.sh platform with odoo14. The installed wkhtmltopdf is wkhtmltopdf_paas_wrapper 0.12.5, we can't upgrade to 0.12.6 because the access is very limited we cant use 'sudo' to apt-install. To temporarily solve this, we decided to use the 0.12.5 version. But it returns "Unable to call host printing service (HTTPError)" even with the right arguments. I've already tried it with the staging and production server, but still the same result. The ticket I've sent hasn't been replied to yet. This is so frustrating, I'm going bonkers...please help.
here's a screenshot:
ps: unrecognized argument error was intentional so I can display the available args. I've also crossed out the project domain. Thank you
Apparently, to properly execute the package, it should not have been "wkhtmltopdf" but instead "wkhtmltopdf.bin". I've overridden the ir_actions_report.py to change the package name. Here's the snippet of the original source code:
They shouldve known better, its a paid platform.

protoc command not generating all base classes (java)

I have been trying to generate the basic gRPC client and server interfaces from a .proto service definition here from the grpc official repo.
The relevant service defined in that file (from the link above) is below:
service RouteGuide {
rpc GetFeature(Point) returns (Feature) {}
rpc ListFeatures(Rectangle) returns (stream Feature) {}
rpc RecordRoute(stream Point) returns (RouteSummary) {}
rpc RouteChat(stream RouteNote) returns (stream RouteNote) {}
}
The command I run is protoc --java_out=${OUTPUT_DIR} path/to/proto/file
According to the grpc site (specifically here), a RouteGuideGrpc.java which contains a base class RouteGuideGrpc.RouteGuideImplBase, with all the methods defined in the RouteGuide service is supposed to have been generated from the protoc command above, but that file does not get generated for me.
Has anyone faced similar issues? Is the official documentation simply incorrect? And would anyone have any suggestion as to what I can do to generate that missing class?
This may help someone else in the future so I'll answer my own question.
I believe the java documentation for gRPC code generation is not fully up to date and the information is scattered amongst different official repositories.
So turns out that in order to generate all the gRPC java service base classes as expected, you need to specify an additional flag to the protoc cli like so grpc-java_out=${OUTPUT_DIR}. But in order for that additional flag to work, you need to have a few extra things:
The binary for the protoc plugin for gRPC Java protoc-gen-grpc-java: you can get the relevant one for your system from maven central here (the link is for v1.17.1). If there isn't a prebuilt binary available for your system, you can compile one yourself from the github repo instructions here.
Make sure the binary location is added to your PATH environment variable and the binary is renamed to "protoc-gen-grpc-java" exactly (that is the name the protoc cli expects to have in the path).
Finally, you are ready to run the correct command protoc --java_out=${OUTPUT_DIR} --grpc-java_out=${OUTPUT_DIR} path/to/proto/file and now the service base classes like RouteGuideGrpc.RouteGuideImplBase should be generated when it previously was not.
I hope this explanation helps someone else out in the future.
Thank you very much for this investigation. Indeed, the doc is incomplete, and people use Maven to compile everything without understanding of how it really works. Yp

Using SimpleHttpFileServer with Gradle

I'm running some unit tests on Android, and I have to run an http server locally to get images from it during my tests. Until now, I'm using a python script that run the SimpleHttpServer of python, then call Gradle, then kill the server at the end.
I've found that there is a SimpleHttpFileServer that could be used in Gradle.
But I can't make it work. I found absolutely nothing about usage of this
class, except the doc here :
https://gradle.org/docs/current/javadoc/org/gradle/plugins/javascript/envjs/http/simple/SimpleHttpFileServer.html
that doesn't say much. What is a Stoppable for instance? No doc about it.
When I try to use it, I have this error :
Could not find matching constructor for:
org.gradle.plugins.javascript.envjs.http.simple.SimpleHttpFileServer
Anyone here has played with that? Or do you see any other way to do it? Another idea was to run the python server from Gradle, then kill it at the end, probably using task.finalizedBy, but I didn't success either.
Any help on any of those methods would be appreciated.
Thanks,
GĂ©rald

Restart Go's net/http server on file-change like Django

I'm trying out Martini, which adds some nice functionality upon Go's basic net/http package.
I was wondering tho. How can I, like Django does too, let the server restart itself on source-file changes? I know how to monitor a file, but I'm not sure how to retrigger the Server within the same process.
I'm guessing to trigger http.ListenAndServe again, but I have a feeling it doesn't go well with instance already running.
Do I need to spawn a subprocess/daemon to get this working?
Maybe you need gin ?
Made by the creator of Martini.
You may give it a try
Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file.
You'll need to use an external tool that can watch a directory/files and run a command. I'd recommend reflex which is written in Go itself:
(modifying the example in the README):
# Rerun make whenever a .go file changes
reflex -r '\.go$' ./mymartiniapp

Is it possible to run locally JRuby on Google App Engine without restarting server on every change?

Unfortunately, GAE requires restart of the server on each code change.
Is it possible to prevent it and have immediate feedback after code save?
Or, can I import Google App Engine's API into my ruby code and run it on Sinatra server? Tried this but it fails on "import com.google.appengine.api" (it doesn't know what 'com' is).
For Sinatra, I use "Rerun" ( http://github.com/alexch/rerun ) which restarts server immediately after a change with minimum wait.
Thanks.
Try http://github.com/rkh/sinatra-reloader
OK, seems like JRuby on Rails doesn't need server restart, Sinatra reloaded/shotgun plugins didn't work well for me.
To run it I copied the files from http://rails-depot.appspot.com/src (the source # http://code.google.com/p/appengine-jruby/source/browse did not contain all the files).

Resources