_id
stringlengths
2
7
title
stringclasses
1 value
partition
stringclasses
3 values
text
stringlengths
6
2.61k
language
stringclasses
1 value
meta_information
dict
c24400
train
// SetMaxReconnectInterval sets the maximum time that will be waited between reconnection attempts // when connection is lost
{ "resource": "" }
c24401
train
// SetAutoReconnect sets whether the automatic reconnection logic should be used // when the connection is lost, even if disabled the ConnectionLostHandler is still // called
{ "resource": "" }
c24402
train
// SetMessageChannelDepth sets the size of the internal queue that holds messages while the // client is temporairily offline, allowing the application to publish when the client is // reconnecting. This setting is only valid if AutoReconnect is set to true, it is otherwise // ignored.
{ "resource": "" }
c24403
train
// SetHTTPHeaders sets the additional HTTP headers that will be sent in the WebSocket // opening handshake.
{ "resource": "" }
c24404
train
// WaitTimeout takes a time.Duration to wait for the flow associated with the // Token to complete, returns true if it returned before the timeout or // returns false if the timeout occurred. In the case of a timeout the Token // does not have an error set in case the caller wishes to wait again
{ "resource": "" }
c24405
train
// Result returns a map of topics that were subscribed to along with // the matching return code from the broker. This is either the Qos // value of the subscription or an error code.
{ "resource": "" }
c24406
train
//Servers returns a slice of the servers defined in the clientoptions
{ "resource": "" }
c24407
train
// Open initializes a MemoryStore instance.
{ "resource": "" }
c24408
train
// Get takes a key and looks in the store for a matching Message // returning either the Message pointer or nil.
{ "resource": "" }
c24409
train
// Del takes a key, searches the MemoryStore and if the key is found // deletes the Message pointer associated with it.
{ "resource": "" }
c24410
train
// AddRoute allows you to add a handler for messages on a specific topic // without making a subscription. For example having a different handler // for parts of a wildcard subscription
{ "resource": "" }
c24411
train
// IsConnectionOpen return a bool signifying whether the client has an active // connection to mqtt broker, i.e not in disconnected or reconnect mode
{ "resource": "" }
c24412
train
// Publish will publish a message with the specified QoS and content // to the specified topic. // Returns a token to track delivery of the message to the broker
{ "resource": "" }
c24413
train
// Load all stored messages and resend them // Call this to ensure QOS > 1,2 even after an application crash
{ "resource": "" }
c24414
train
// OptionsReader returns a ClientOptionsReader which is a copy of the clientoptions // in use by the client.
{ "resource": "" }
c24415
train
//Copy creates a new PublishPacket with the same topic and payload //but an empty fixed header, useful for when you want to deliver //a message with different properties such as Qos but the same //content
{ "resource": "" }
c24416
train
// NewFileStore will create a new FileStore which stores its messages in the // directory provided.
{ "resource": "" }
c24417
train
// Open will allow the FileStore to be used.
{ "resource": "" }
c24418
train
// All will provide a list of all of the keys associated with messages // currenly residing in the FileStore.
{ "resource": "" }
c24419
train
// Del will remove the persisted message associated with the provided // key from the FileStore.
{ "resource": "" }
c24420
train
// Reset will remove all persisted messages from the FileStore.
{ "resource": "" }
c24421
train
// newRouter returns a new instance of a Router and channel which can be used to tell the Router // to stop
{ "resource": "" }
c24422
train
// addRoute takes a topic string and MessageHandler callback. It looks in the current list of // routes to see if there is already a matching Route. If there is it replaces the current // callback with the new one. If not it add a new entry to the list of Routes.
{ "resource": "" }
c24423
train
// deleteRoute takes a route string, looks for a matching Route in the list of Routes. If // found it removes the Route from the list.
{ "resource": "" }
c24424
train
// setDefaultHandler assigns a default callback that will be called if no matching Route // is found for an incoming Publish.
{ "resource": "" }
c24425
train
// NewEncodedConn will wrap an existing Connection and utilize the appropriate registered // encoder.
{ "resource": "" }
c24426
train
// RegisterEncoder will register the encType with the given Encoder. Useful for customization.
{ "resource": "" }
c24427
train
// EncoderForType will return the registered Encoder for the encType.
{ "resource": "" }
c24428
train
// Publish publishes the data argument to the given subject. The data argument // will be encoded using the associated encoder.
{ "resource": "" }
c24429
train
// Dissect the cb Handler's signature
{ "resource": "" }
c24430
train
// Subscribe will create a subscription on the given subject and process incoming // messages using the specified Handler. The Handler should be a func that matches // a signature from the description of Handler from above.
{ "resource": "" }
c24431
train
// QueueSubscribe will create a queue subscription on the given subject and process // incoming messages using the specified Handler. The Handler should be a func that // matches a signature from the description of Handler from above.
{ "resource": "" }
c24432
train
// Internal implementation that all public functions will use.
{ "resource": "" }
c24433
train
// cloneMsgArg is used when the split buffer scenario has the pubArg in the existing read buffer, but // we need to hold onto it into the next read.
{ "resource": "" }
c24434
train
// GetDefaultOptions returns default configuration options for the client.
{ "resource": "" }
c24435
train
// Options that can be passed to Connect. // Name is an Option to set the client name.
{ "resource": "" }
c24436
train
// RootCAs is a helper option to provide the RootCAs pool from a list of filenames. // If Secure is not already set this will set it as well.
{ "resource": "" }
c24437
train
// ClientCert is a helper option to provide the client certificate from a file. // If Secure is not already set this will set it as well.
{ "resource": "" }
c24438
train
// ReconnectWait is an Option to set the wait time between reconnect attempts.
{ "resource": "" }
c24439
train
// MaxReconnects is an Option to set the maximum number of reconnect attempts.
{ "resource": "" }
c24440
train
// MaxPingsOutstanding is an Option to set the maximum number of ping requests // that can go un-answered by the server before closing the connection.
{ "resource": "" }
c24441
train
// ReconnectBufSize sets the buffer size of messages kept while busy reconnecting.
{ "resource": "" }
c24442
train
// DisconnectHandler is an Option to set the disconnected handler.
{ "resource": "" }
c24443
train
// ReconnectHandler is an Option to set the reconnected handler.
{ "resource": "" }
c24444
train
// ClosedHandler is an Option to set the closed handler.
{ "resource": "" }
c24445
train
// DiscoveredServersHandler is an Option to set the new servers handler.
{ "resource": "" }
c24446
train
// ErrorHandler is an Option to set the async error handler.
{ "resource": "" }
c24447
train
// UserInfo is an Option to set the username and password to // use when not included directly in the URLs.
{ "resource": "" }
c24448
train
// Token is an Option to set the token to use // when a token is not included directly in the URLs // and when a token handler is not provided.
{ "resource": "" }
c24449
train
// TokenHandler is an Option to set the token handler to use // when a token is not included directly in the URLs // and when a token is not set.
{ "resource": "" }
c24450
train
// UserCredentials is a convenience function that takes a filename // for a user's JWT and a filename for the user's private Nkey seed.
{ "resource": "" }
c24451
train
// UserJWT will set the callbacks to retrieve the user's JWT and // the signature callback to sign the server nonce. This an the Nkey // option are mutually exclusive.
{ "resource": "" }
c24452
train
// Nkey will set the public Nkey and the signature callback to // sign the server nonce.
{ "resource": "" }
c24453
train
// SetCustomDialer is an Option to set a custom dialer which will be // used when attempting to establish a connection. If both Dialer // and CustomDialer are specified, CustomDialer takes precedence.
{ "resource": "" }
c24454
train
// Handler processing // SetDisconnectHandler will set the disconnect event handler.
{ "resource": "" }
c24455
train
// SetReconnectHandler will set the reconnect event handler.
{ "resource": "" }
c24456
train
// SetDiscoveredServersHandler will set the discovered servers handler.
{ "resource": "" }
c24457
train
// SetClosedHandler will set the reconnect event handler.
{ "resource": "" }
c24458
train
// SetErrorHandler will set the async error handler.
{ "resource": "" }
c24459
train
// Process the url string argument to Connect. // Return an array of urls, even if only one.
{ "resource": "" }
c24460
train
// Connect will attempt to connect to a NATS server with multiple options.
{ "resource": "" }
c24461
train
// Return the currently selected server
{ "resource": "" }
c24462
train
// Pop the current server and put onto the end of the list. Select head of list as long // as number of reconnect attempts under MaxReconnect.
{ "resource": "" }
c24463
train
// Will assign the correct server to nc.current
{ "resource": "" }
c24464
train
// Create the server pool using the options given. // We will place a Url option first, followed by any // Server Options. We will randomize the server pool unless // the NoRandomize flag is set.
{ "resource": "" }
c24465
train
// addURLToPool adds an entry to the server pool
{ "resource": "" }
c24466
train
// shufflePool swaps randomly elements in the server pool
{ "resource": "" }
c24467
train
// createConn will connect to the server and wrap the appropriate // bufio structures. It will do the right thing when an existing // connection is in place.
{ "resource": "" }
c24468
train
// makeTLSConn will wrap an existing Conn using TLS
{ "resource": "" }
c24469
train
// Report the connected server's Url
{ "resource": "" }
c24470
train
// ConnectedAddr returns the connected server's IP
{ "resource": "" }
c24471
train
// Report the connected server's Id
{ "resource": "" }
c24472
train
// Low level setup for structs, etc
{ "resource": "" }
c24473
train
// Process a connected connection and initialize properly.
{ "resource": "" }
c24474
train
// Main connect function. Will connect to the nats-server
{ "resource": "" }
c24475
train
// This will check to see if the connection should be // secure. This can be dictated from either end and should // only be called after the INIT protocol has been received.
{ "resource": "" }
c24476
train
// processExpectedInfo will look for the expected first INFO message // sent when a connection is established. The lock should be held entering.
{ "resource": "" }
c24477
train
// Sends a protocol control message by queuing into the bufio writer // and kicking the flush Go routine. These writes are protected.
{ "resource": "" }
c24478
train
// normalizeErr removes the prefix -ERR, trim spaces and remove the quotes.
{ "resource": "" }
c24479
train
// reads a protocol one byte at a time.
{ "resource": "" }
c24480
train
// Read a control line and process the intended op.
{ "resource": "" }
c24481
train
// Parse a control line from the server.
{ "resource": "" }
c24482
train
// flushReconnectPending will push the pending items that were // gathered while we were in a RECONNECTING state to the socket.
{ "resource": "" }
c24483
train
// Try to reconnect using the option parameters. // This function assumes we are allowed to reconnect.
{ "resource": "" }
c24484
train
// processOpErr handles errors from reading or parsing the protocol. // The lock should not be held entering this function.
{ "resource": "" }
c24485
train
// dispatch is responsible for calling any async callbacks
{ "resource": "" }
c24486
train
// Add the given function to the tail of the list and // signals the dispatcher.
{ "resource": "" }
c24487
train
// waitForMsgs waits on the conditional shared with readLoop and processMsg. // It is used to deliver messages to asynchronous subscribers.
{ "resource": "" }
c24488
train
// processPermissionsViolation is called when the server signals a subject // permissions violation on either publish or subscribe.
{ "resource": "" }
c24489
train
// processAuthorizationViolation is called when the server signals a user // authorization violation.
{ "resource": "" }
c24490
train
// flusher is a separate Go routine that will process flush requests for the write // bufio. This allows coalescing of writes to the underlying socket.
{ "resource": "" }
c24491
train
// processPong is used to process responses to the client's ping // messages. We use pings for the flush mechanism as well.
{ "resource": "" }
c24492
train
// processInfo is used to parse the info messages sent // from the server. // This function may update the server pool.
{ "resource": "" }
c24493
train
// processAsyncInfo does the same than processInfo, but is called // from the parser. Calls processInfo under connection's lock // protection.
{ "resource": "" }
c24494
train
// LastError reports the last error encountered via the connection. // It can be used reliably within ClosedCB in order to find out reason // why connection was closed for example.
{ "resource": "" }
c24495
train
// processErr processes any error messages from the server and // sets the connection's lastError.
{ "resource": "" }
c24496
train
// Publish publishes the data argument to the given subject. The data // argument is left untouched and needs to be correctly interpreted on // the receiver.
{ "resource": "" }
c24497
train
// PublishMsg publishes the Msg structure, which includes the // Subject, an optional Reply and an optional Data field.
{ "resource": "" }
c24498
train
// publish is the internal function to publish messages to a nats-server. // Sends a protocol data message by queuing into the bufio writer // and kicking the flush go routine. These writes should be protected.
{ "resource": "" }
c24499
train
// respHandler is the global response handler. It will look up // the appropriate channel based on the last token and place // the message on the channel if possible.
{ "resource": "" }