No results for

Powered byAlgolia

Client.connect(address [,params])

suggest edits

Opens a connection to a gRPC server; will block until a connection is made or a connection error is thrown. Cannot be called during the init phase.

See Client.close() to close the connection.

ParameterTypeDescription
addressstringThe address of the gRPC server. Should be in the form: host:port with no protocol prefix e.g. grpc.k6.io:443. The host must be a literal IP address, or a host name that can be resolved to IP addresses. The port must be a literal port number or a service name e.g. :443 or :https. If the host is a literal IPv6 address it must be enclosed in square brackets, as in [2001:db8::1]:80 or [fe80::1%zone]:80.
params (optional)objectConnectParams object containing additional connect parameters.

ConnectParams

NameTypeDescription
ConnectParams.plaintextboolIf true will connect to the gRPC server using plaintext i.e. insecure. Defaults to false i.e. secure via TLS.
ConnectParams.timeoutnumberConnection timeout to use. Default timeout is "60s" (60 seconds).

Examples

import grpc from "k6/net/grpc";
const client = new grpc.Client();
export default () => {
client.connect("localhost:8080");
}
import grpc from "k6/net/grpc";
const client = new grpc.Client();
export default () => {
client.connect("localhost:8080", { plaintext: true });
}