Link between ports of same element

I am trying to design a network diagram containing various network components using GoJS.

Can we display links between ports of the same element?
Also, I want the end user to be able to draw links between these ports.It looks like a port can be connected to a port of different element only.

Is this possible using GoJS?

What do you mean by “element”? If you mean Node, then yes you can have a Link connecting two ports that are both in the same Node.

Note that by default the LinkingTool does not allow the user to draw such links. But you can set GraphObject.fromLinkableSelfNode and GraphObject.toLinkableSelfNode to true on those port objects. Read more at GoJS Validation -- Northwoods Software.