Skip to content

sarjsheff/natsv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

module natsv

Client lib for nats.io.

Contents

MSG

struct MSG {
mut:
	subid string
pub mut:
	subject string
	msg     string
	size    int
}

[Return to contents]

Nats

struct Nats {
pub mut:
	verbose  bool
	pedantic bool
	echo     bool
mut:
	url       string
	user      string
	pass      string
	lastid    int
	handlers  shared map[string]SubjectHandler
	inch      chan string
	inmsg     chan MSG
	info      json2.Any
	connected bool
	c         net.TcpConn
}

[Return to contents]

connect

fn (mut n Nats) connect(url string, user string, pass string) ?

Connect to nats server.

[Return to contents]

close

fn (mut n Nats) close() ?

Close connection.

[Return to contents]

sub

fn (mut n Nats) sub(subject string, cb SubjectHandler) ?string

Subscribe to subject.

[Return to contents]

usub

fn (mut n Nats) usub(subid string) ?

Unsubscribe to subject.

[Return to contents]

publish

fn (mut n Nats) publish(subject string, msg string) ?

Publish message.

[Return to contents]

Powered by vdoc. Generated on: 2 Aug 2021 11:14:31