-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init network bus interface and added new example
- Loading branch information
1 parent
122fb7c
commit abc0ccc
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package main | ||
|
||
import ( | ||
goeventbus "github.com/stanipetrosyan/go-eventbus" | ||
) | ||
|
||
var eventbus = goeventbus.NewEventBus() | ||
|
||
func main() { | ||
network := goeventbus.NewNetworkBus(eventbus, "localhost", "/bus") | ||
network.Client() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package main | ||
|
||
import ( | ||
goeventbus "github.com/stanipetrosyan/go-eventbus" | ||
) | ||
|
||
var eventbus = goeventbus.NewEventBus() | ||
|
||
func main() { | ||
network := goeventbus.NewNetworkBus(eventbus, "localhost", "/bus") | ||
network.Server() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package goeventbus | ||
|
||
type NetworkBus interface { | ||
Server() | ||
Client() | ||
} | ||
|
||
type defaultNetworkBus struct { | ||
localBus EventBus | ||
address string | ||
path string | ||
} | ||
|
||
func NewNetworkBus(bus EventBus, address, path string) NetworkBus { | ||
return defaultNetworkBus{localBus: bus, address: address, path: path} | ||
} | ||
|
||
func (b defaultNetworkBus) Server() {} | ||
|
||
func (b defaultNetworkBus) Client() {} |